mp3 tag/rename based on creation (last modified date)


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting mp3 tag/rename based on creation (last modified date)
# 1  
Old 11-23-2009
mp3 tag/rename based on creation (last modified date)

Arg, I'm trying to figure out how to create a album tag based on the last modified date stamp for files which don't have a corresponding .talk file.
IE. 2009 12 10 - Talk Radio.mp3 is how I want them structured, they should all have a corresponding .talk file so my mp3 player can speak the name ie 2009 12 10 - Talk Radio.mp3.talk.
Any file with a .talk file should be skipped because its already been processed manually by me. Here is what I've got in my script so far...

Code:
#!/bin/bash
for f in *.mp3
do
        # if .talk backup file exists, read next file
        if [ -f ${f}.talk ]
        then
                echo "Skiping $f file..."
                continue  # read next file
        fi
        # no talk file exists
        DATE=`stat -c "%y" $f | awk '{print $1}' | sed 's/-/ /g'`
        id3v2 -A "$DATE" "$f"
        mp3rename $f
done

for f in *.mp3
do
        # if .talk backup file exists, read next file
        if [ -f ${f}.talk ]
        then
                echo "Skiping $f file..."
                continue  # read next file
        fi
        # no talk file exists
        echo $f > temp.tmp
        text2wav temp.tmp -o temp.wav
        rbspeexenc temp.wav $f.talk
done

Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Bourne returning files based on creation date

I'm wanting to write a bourne shell script that takes in two command line arguments - a directory and a file. With this I want to return a list of files within the directory that are older (based on creation date) than the given file, and print the number of files that have not been listed (they... (4 Replies)
Discussion started by: britty4
4 Replies

2. Shell Programming and Scripting

Script to copy creation date over top of modified date?

Can someone draw up a script that for every file, folder and subfolder and files that will copy the creation date over top of the modified date?? I know how to touch every file recursively, but no idea how to read a files creation date then use that to touch the modification date of that file,... (3 Replies)
Discussion started by: toysareforboys
3 Replies

3. UNIX for Dummies Questions & Answers

Unable to find files, those can be present anywhere in the directory tree,based on its creation date

Hi I am unable to find files, those are present anywhere in the same directory tree, based on the creation date. I need to find the files with their path, as I need to create them in another location and move them. I need some help with a script that may do the job. Please help (2 Replies)
Discussion started by: sam192837465
2 Replies

4. UNIX for Dummies Questions & Answers

Select all files in a folder based on creation date (ls command)

Hi All, <Re-posting in Correct group> I'm trying to select all the files in a folder that starts with a particular name format and are created in a gven date range using 'ls' command...but i'm not successful.... Example : I'm trying to see all the text files in a folder who names start... (6 Replies)
Discussion started by: Satya C1
6 Replies

5. Shell Programming and Scripting

Move files from one directory to another based on creation/modification date

Hi All, Really stuck up with a requirement where I need to move a file (Lets say date_Employee.txt--the date will have different date values like 20120612/20120613 etc) from one directory to another based on creation/modification dates. While visiting couple of posts, i could see we can... (3 Replies)
Discussion started by: dsfreddie
3 Replies

6. Programming

how to add user defined tag in a mp3 file?

Hai all, Can anyone explain me about how to add an user defined tag in an mp3 file using MP3::Tag module in perl? (0 Replies)
Discussion started by: thillai_selvan
0 Replies

7. UNIX for Dummies Questions & Answers

Moving Directories Based on Modified date

Hi, How can I move directories (and all sub directories/files) from one directory to another based on the modified date of the directory? Currently the existing structure looks like this: /public_html/media/videos/tmb/34947/image1.jpg /public_html/media/videos/tmb/34947/image2.jpg ... (0 Replies)
Discussion started by: lbargers
0 Replies

8. Shell Programming and Scripting

Rename File Based on Created Date

I am trying to rename files based on the created/born date of the file. I Have a total of 4000 files that i am trying to do this with and would like it to be log_yyyymmddhh.gz right now the files are maillog.???.gz. Can anyone point me in the right direction of how to get this done via scipt? ... (4 Replies)
Discussion started by: Paulb
4 Replies

9. UNIX for Dummies Questions & Answers

Moving files based on creation date

Howdy, I'm trying to figure out how to move multiple files based on their creation date. If anyone can enlighten me it would be most appreciated!! Thanks! :D (1 Reply)
Discussion started by: dgoyea
1 Replies
Login or Register to Ask a Question
MP3::Tag::File(3pm)					User Contributed Perl Documentation				       MP3::Tag::File(3pm)

NAME
MP3::Tag::File - Module for reading / writing files SYNOPSIS
my $mp3 = MP3::Tag->new($filename); ($title, $artist, $no, $album, $year) = $mp3->parse_filename(); see MP3::Tag DESCRIPTION
MP3::Tag::File is designed to be called from the MP3::Tag module. It offers possibilities to read/write data from files via read(), write(), truncate(), seek(), tell(), open(), close(); one can find the filename via the filename() method. parse_filename() ($title, $artist, $no, $album, $year) = $mp3->parse_filename($what, $filename); parse_filename() tries to extract information about artist, title, track number, album and year from the filename. (For backward compatibility it may be also called by deprecated name read_filename().) This is likely to fail for a lot of filenames, especially the album will be often wrongly guessed, as the name of the parent directory is taken as album name. $what and $filename are optional. $what maybe title, track, artist, album or year. If $what is defined parse_filename() will return only this element. If $filename is defined this filename will be used and not the real filename which was set by MP3::Tag with "MP3::Tag->new($filename)". Otherwise the actual filename is used (subject to configuration variable "decode_encoding_filename"). Following formats will be hopefully recognized: - album name/artist name - song name.mp3 - album_name/artist_name-song_name.mp3 - album.name/artist.name_song.name.mp3 - album name/(artist name) song name.mp3 - album name/01. artist name - song name.mp3 - album name/artist name - 01 - song.name.mp3 If artist or title end in "(NUMBER)" with 4-digit NUMBER, it is considered the year. title() $title = $mp3->title($filename); Returns the title, guessed from the filename. See also parse_filename(). (For backward compatibility, can be called by deprecated name song().) $filename is optional and will be used instead of the real filename if defined. artist() $artist = $mp3->artist($filename); Returns the artist name, guessed from the filename. See also parse_filename() $filename is optional and will be used instead of the real filename if defined. track() $track = $mp3->track($filename); Returns the track number, guessed from the filename. See also parse_filename() $filename is optional and will be used instead of the real filename if defined. year() $year = $mp3->year($filename); Returns the year, guessed from the filename. See also parse_filename() $filename is optional and will be used instead of the real filename if defined. album() $album = $mp3->album($filename); Returns the album name, guessed from the filename. See also parse_filename() The album name is guessed from the parent directory, so it is very likely to fail. $filename is optional and will be used instead of the real filename if defined. comment() $comment = $mp3->comment($filename); # Always undef genre() $genre = $mp3->genre($filename); # Always undef perl v5.14.2 2009-11-28 MP3::Tag::File(3pm)