Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
03-27-2011, 06:27 PM
|
#1
|
Member
Registered: Mar 2011
Posts: 58
Rep:
|
I need help about MP3::Tag and perl script.
Hi everyone, I am a newbie on linux and just searching everything about perl scripting and modules nearly 3-4 days. I need a perl script but one of not easy to find on searching google. Okey now I need a perl script which create or recreate (edit) id3 tags (artist,comment,album,year,cover) of mp3 files stored on my linux centos server. I installed MP3::Tag version 1.13 pearl module to my server. I Searched tutorials about how to use it, finally I get through reading id3 tag of mp3 file but not achieve to modify it or create a new id3tag. So I need your help and knowledge about scripting.
These are the details:
I have a mp3 file called 1.mp3 this script will process that '1.mp3' file read its id3tag if there is one, than modify or create id3tag for it by my fix artist name for example:
'1.mp3' files id3 tag details are like this
Artist: Dj xx
Year:2010
Title:yyyyy
Comment:eerwer
Cover: x.jpg
now via this perl script which uses MP3::TAG I will change it's
artist as YYY
Title:ttt
Comment:cool
Cover:t.jpg
these are gonna be my fixed values. I mean all '1.mp3' file will have same artist based on script value.
The reason of this script is I will share Dj podcasts on my server and Dj's would have upload their mp3's which has got different id3 tags and cover pics. etc. I want to create more organized podcasts of them by the way I would trigger this perl script via Cronjob.
Thank you for your help and sorry for taking up your time 
Last edited by osmy; 03-27-2011 at 06:44 PM.
|
|
|
03-28-2011, 05:26 AM
|
#2
|
Member
Registered: Mar 2011
Posts: 58
Original Poster
Rep:
|
Does anyone knows that?
|
|
|
03-28-2011, 09:48 AM
|
#3
|
Moderator
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,980
|
Please post your thread in only one forum. Posting a single thread in the most relevant forum will make it easier for members to help you and will keep the discussion in one place. This thread is being reported because it is a duplicate.
Last edited by onebuck; 03-28-2011 at 10:34 AM.
Reason: correct error for triplicate
|
|
|
03-28-2011, 10:15 AM
|
#4
|
LQ Guru
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509
|
Thank you for the report, onebuck! This one stays open, since the other one has been closed, therefore the discussion can continue here.
|
|
|
03-28-2011, 10:22 AM
|
#5
|
LQ Guru
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509
|
@osmy: I'm not an expert of Perl's MP3::Tag, but if you posted the code you've written so far, it would be easier to give help.
|
|
|
03-28-2011, 12:03 PM
|
#6
|
Member
Registered: Mar 2011
Posts: 58
Original Poster
Rep:
|
Ok here is the code I need help. Also woul like to add cover changin function
Thanks!
#!/usr/bin/perl
use MP3::Tag;
$mp3 = MP3::Tag->new('1.mp3'); # create object
$mp3->get_tags(); # read tags
if (exists $mp3->{ID3v1}) {
$mp3->{ID3v1}->title("ttt");
$mp3->{ID3v1}->artist("YYY");
$mp3->{ID3v1}->album("zzz");
$mp3->{ID3v1}->year("2010");
$mp3->{ID3v1}->write_tag();
}
$mp3->close(); # destroy object
|
|
|
03-28-2011, 06:22 PM
|
#7
|
Member
Registered: Mar 2011
Posts: 58
Original Poster
Rep:
|
Any Solution?
|
|
|
03-29-2011, 10:37 AM
|
#8
|
Member
Registered: Mar 2011
Posts: 58
Original Poster
Rep:
|
Quote:
Originally Posted by colucix
@osmy: I'm not an expert of Perl's MP3::Tag, but if you posted the code you've written so far, it would be easier to give help.
|
Any Updates? I need a quick help!
|
|
|
03-29-2011, 06:31 PM
|
#9
|
LQ Guru
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.x
Posts: 18,440
|
There are a couple of things you could do
1) ask the Mods via the Report button to move this to the Programming forum
2) also post this qn at www.perlmonks.org; that's where the Perl gurus hang out.
Please remember that this site is entirely voluntary & people hang out here as and when they feel like it and answer qns in the same vein.
|
|
|
03-29-2011, 07:52 PM
|
#10
|
Moderator
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
|
Moved: This thread is more suitable in <PROGRAMMING> and has been moved accordingly to help your thread/question get the exposure it deserves.
|
|
|
03-29-2011, 08:05 PM
|
#11
|
Member
Registered: Mar 2011
Posts: 58
Original Poster
Rep:
|
Thanks moderator! Looking for help in here!
|
|
|
03-29-2011, 08:19 PM
|
#12
|
Moderator
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
|
I found the man-page (man MP3::Tag) quite readable (never used MP3::Tag),
and it kind of suggests that write_tag is discouraged, and you should
favour
Code:
$mp3->title_set('New title'); # Edit in-memory copy
$mp3->select_id3v2_frame_by_descr('TALB', 'New album name'); # Edit in
memory
$mp3->select_id3v2_frame_by_descr('RBUF', $n1, $n2, $n3); # Edit in
memory
$mp3->update_tags({year => 1866}); # Edit in-memory, and commit to file
$mp3->update_tags(); # Commit to file
Cheers,
Tink
|
|
|
03-29-2011, 08:35 PM
|
#13
|
Member
Registered: Mar 2011
Posts: 58
Original Poster
Rep:
|
I understand what you saying Tinkster, But I am a newbie and do not know how to integrate this codes and work it with perl script. =(
|
|
|
03-31-2011, 10:02 AM
|
#14
|
Member
Registered: Mar 2011
Posts: 58
Original Poster
Rep:
|
does anybody knows this. Please I need help here!
|
|
|
03-31-2011, 11:28 AM
|
#15
|
Moderator
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
|
I'd recommend finding a good book on perl, or maybe a tutorial.
You seriously can't expect people to write code FOR you.
Cheers,
Tink
|
|
|
All times are GMT -5. The time now is 03:14 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|