You Are Here:

Community: Developer Discussion Boards

#1 Old ID3 TAG PROBLEM - 2008-10-31, 12:33

Join Date: Aug 2008
Posts: 148
cool_eagle
Offline
Regular Contributor
Code:
def getID3(filename):
    fp = open(filename, 'r')
    fp.seek(-128, 2)
 
    fp.read(3) # TAG iniziale
    title   = fp.read(30)
    artist  = fp.read(30)
    album   = fp.read(30)
    year    = fp.read(4)
    comment = fp.read(28)
 
    fp.close()
 
    return {'title':title, 'artist':artist, 'album':album, 'year':year}


info = getID3('c:\\example.mp3')
a=info['title']
f=open('c:\\title.txt','w')
f.write(a)
f.close()
and this code write into a.txt EXAMPLE ????????????????????
how can i solve this problem. i dont want this '????????'
Reply With Quote

#2 Old Re: ID3 TAG PROBLEM - 2008-10-31, 13:26

Join Date: Oct 2007
Posts: 2,841
Location: Deva, Romania
bogdan.galiceanu's Avatar
bogdan.galiceanu
Offline
Forum Nokia Champion
Quote:
Originally Posted by cool_eagle View Post
Code:
def getID3(filename):
    fp = open(filename, 'r')
    fp.seek(-128, 2)
 
    fp.read(3) # TAG iniziale
    title   = fp.read(30)
    artist  = fp.read(30)
    album   = fp.read(30)
    year    = fp.read(4)
    comment = fp.read(28)
 
    fp.close()
 
    return {'title':title, 'artist':artist, 'album':album, 'year':year}


info = getID3('c:\\example.mp3')
a=info['title']
f=open('c:\\title.txt','w')
f.write(a)
f.close()
and this code write into a.txt EXAMPLE ????????????????????
how can i solve this problem. i dont want this '????????'
What problem? All you really did was write "example" and "?" in capitals and red, and "i dont want this" and "?" in orange. You're going to have to explain it better than that.
Last edited by bogdan.galiceanu : 2008-10-31 at 13:32.
Reply With Quote

#3 Old Re: ID3 TAG PROBLEM - 2008-10-31, 14:32

Join Date: Aug 2008
Posts: 148
cool_eagle
Offline
Regular Contributor
this code write in to title.txt

EXAMPLE ??????????????????????????

i want to write EXAMPLE.

not EXAMPLE???????????????????????
Reply With Quote

#4 Old Re: ID3 TAG PROBLEM - 2008-10-31, 14:49

Join Date: Mar 2003
Posts: 937
Location: Espoo, Finland
JOM's Avatar
JOM
Offline
Forum Nokia Champion
Quote:
Originally Posted by cool_eagle View Post
this code write in to title.txt

EXAMPLE ??????????????????????????

i want to write EXAMPLE.

not EXAMPLE???????????????????????
Ok, I'll hazard a guess: you want to write text string "EXAMPLE", but you find "EXAMPLE???????????????????????" inside the file afterwards?

Well, looking at your code and guessing the number of "?" characters, I would say you write exactly what you read from the MP3 file:

Code:
title = fp.read(30)
a=info['title']
f.write(a)
Therefore I would say the problem is in data instead of code. Why do you think title would be exactly 30 characters? Always?

Cheers,

--jouni
Reply With Quote

#5 Old Re: ID3 TAG PROBLEM - 2008-10-31, 15:46

Join Date: Aug 2008
Posts: 148
cool_eagle
Offline
Regular Contributor
Quote:
Originally Posted by JOM View Post
Ok, I'll hazard a guess: you want to write text string "EXAMPLE", but you find "EXAMPLE???????????????????????" inside the file afterwards?

Well, looking at your code and guessing the number of "?" characters, I would say you write exactly what you read from the MP3 file:

Code:
title = fp.read(30)
a=info['title']
f.write(a)
Therefore I would say the problem is in data instead of code. Why do you think title would be exactly 30 characters? Always?

Cheers,

--jouni
thanks
Reply With Quote

#6 Old Re: ID3 TAG PROBLEM - 2008-10-31, 17:01

Join Date: Aug 2008
Posts: 148
cool_eagle
Offline
Regular Contributor
how can know lenght of title :S
fp.read(10) or fp.read(15) exmple
Reply With Quote

#7 Old Re: ID3 TAG PROBLEM - 2008-10-31, 17:09

Join Date: Dec 2007
Posts: 409
Location: Tempe, AZ
Send a message via Yahoo to shubhendra Send a message via Skype™ to shubhendra
shubhendra's Avatar
shubhendra
Offline
Forum Nokia Champion
Maybe you can try "readline()", where you can read the lines like if you place title on first line, then artist on second line

or

You can differentiate between all the artists, albums etc with some identifier like colon,comma etc.


IDEAS is all they need but still they think only Genius can give them that.
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules

You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump
Similar Threads
Thread Thread Starter Forum Replies Last Post
Autostart application and reading tag UID with one touch choege Near Field Communication 5 2008-01-03 14:45
netcards - Problem with opening adapter kernj Symbian Tools & SDKs 5 2007-01-10 09:56
Problem: S60 SDK for CW in PC with .NET anttij Carbide.c++ IDE and plug-ins 1 2005-02-28 12:36
About 6230 Bt Problem eerkek Bluetooth Technology 17 2005-02-08 13:33
7210 Silent Problem MarkMckim Mobile Java General 1 2003-03-18 13:36

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia