LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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


Reply
  Search this Thread
Old 03-27-2011, 06:27 PM   #1
osmy
Member
 
Registered: Mar 2011
Posts: 58

Rep: Reputation: 0
Question 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.
 
Old 03-28-2011, 05:26 AM   #2
osmy
Member
 
Registered: Mar 2011
Posts: 58

Original Poster
Rep: Reputation: 0
Does anyone knows that?
 
Old 03-28-2011, 09:48 AM   #3
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,923
Blog Entries: 44

Rep: Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158
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
 
Old 03-28-2011, 10:15 AM   #4
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
Thank you for the report, onebuck! This one stays open, since the other one has been closed, therefore the discussion can continue here.
 
Old 03-28-2011, 10:22 AM   #5
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
@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.
 
Old 03-28-2011, 12:03 PM   #6
osmy
Member
 
Registered: Mar 2011
Posts: 58

Original Poster
Rep: Reputation: 0
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
 
Old 03-28-2011, 06:22 PM   #7
osmy
Member
 
Registered: Mar 2011
Posts: 58

Original Poster
Rep: Reputation: 0
Any Solution?
 
Old 03-29-2011, 10:37 AM   #8
osmy
Member
 
Registered: Mar 2011
Posts: 58

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by colucix View Post
@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!
 
Old 03-29-2011, 06:31 PM   #9
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,356

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
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.
 
Old 03-29-2011, 07:52 PM   #10
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Moved: This thread is more suitable in <PROGRAMMING> and has been moved accordingly to help your thread/question get the exposure it deserves.
 
Old 03-29-2011, 08:05 PM   #11
osmy
Member
 
Registered: Mar 2011
Posts: 58

Original Poster
Rep: Reputation: 0
Thanks moderator! Looking for help in here!
 
Old 03-29-2011, 08:19 PM   #12
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
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
 
Old 03-29-2011, 08:35 PM   #13
osmy
Member
 
Registered: Mar 2011
Posts: 58

Original Poster
Rep: Reputation: 0
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. =(
 
Old 03-31-2011, 10:02 AM   #14
osmy
Member
 
Registered: Mar 2011
Posts: 58

Original Poster
Rep: Reputation: 0
does anybody knows this. Please I need help here!
 
Old 03-31-2011, 11:28 AM   #15
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
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
 
  


Reply



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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
passing perl variable into input tag in cgi script shifter Programming 1 08-27-2010 06:13 PM
Need assistance with shell script - replace a string with a start tag and end tag SupermanInNY Programming 18 01-02-2010 05:44 PM
Mp3 tag editing? alaios Linux - Software 5 01-31-2009 05:10 AM
Convert ogg to mp3 w/ ID Tag??? VorlonInfoTech Linux - Software 4 01-04-2007 02:22 PM
Good mp3 tag editor Stephanie General 3 09-13-2002 07:47 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:15 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration