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
MP3GAIN(1)						      General Commands Manual							MP3GAIN(1)

NAME
mp3gain -- lossless mp3 normalizer SYNOPSIS
mp3gain [options] [infile] [infile 2 ...] DESCRIPTION
This manual page documents briefly the mp3gain command. This manual page was written for the Debian distribution because the original program does not have a manual page. mp3gain can analyze and adjust mp3 files so that they have the same volume. mp3gain does not just do peak normalization, as many normalizers do. Instead, it does some statistical analysis to determine how loud the file actually sounds to the human ear. Also, the changes mp3gain makes are completely lossless. There is no quality lost in the change because the program adjusts the mp3 file directly, without decoding and re-encoding. mp3gain optionally writes gain adjustments directly into the encoded data. In this case, the adjustment works with all mp3 players, i.e. no support for a special tag is required. This mode is activated by any of the options -r, -a, -g, or -l. If none of the above options are given, the recommended gain change is instead written to a special tag in the mp3 file. In this case, the adjustment only works with mp3 players that support this tag. Some mp3 players refer to this as ReplayGain. The tag is written either in APEv2 format (default) or in ID3v2 format (with -s i). If you only want to print the recommended gain change (and not modify the file at all) you may use the -s s (skip tag) option. The method mp3gain uses to determine the desired volume is described at www.replaygain.org (link to URL http://www.replaygain.org/) . See also /usr/share/doc/mp3gain/README.method . OPTIONS
-? -h Show summary of options. -g i apply gain i to mp3 without doing any analysis -l 0 i apply gain i to channel 0 (left channel) of mp3 without doing any analysis (ONLY works for STEREO mp3s, not Joint Stereo mp3s) -l 1 i apply gain i to channel 1 (right channel) of mp3 without doing any analysis (ONLY works for STEREO mp3s, not Joint Stereo mp3s) -r apply Track gain automatically (all files set to equal loudness) -k automatically lower Track gain to not clip audio -a apply Album gain automatically (files are all from the same album: a single gain change is applied to all files, so their loud- ness relative to each other remains unchanged, but the average album loudness is normalized) -m i modify suggested MP3 gain by integer i -d n modify suggested dB gain by floating-point n -c ignore clipping warning when applying gain -o output is a database-friendly tab-delimited list -t mp3gain writes modified mp3 to temp file, then deletes original instead of modifying bytes in original file (This is the default in Debian) -T mp3gain modifies bytes in original file instead of writing to temp file. -q Quiet mode: no status messages -p Preserve original file timestamp -x Only find max. amplitude of mp3 -f Force mp3gain to assume input file is an MPEG 2 Layer III file (i.e. don't check for mis-named Layer I or Layer II files) -s c only check stored tag info (no other processing) -s d delete stored tag info (no other processing) -s i use ID3v2 tag for gain information; if the file contained gain data in APEv2 format, it is upgraded to ID3v2 -s a use APEv2 tag for gain information (default) -s s skip (ignore) stored tag info (do not read or write tags) -s r force re-calculation (do not read tag info) -u undo changes made by mp3gain (based on stored tag info) -w "wrap" gain change if gain+change > 255 or gain+change < 0 (see below or use -? wrap switch for a complete explanation) -v Show version of program. If you specify -r and -a, only the second one will work. If you do not specify -c, the program will stop and ask before applying gain change to a file that might clip The WRAP option Here's the problem: The "global gain" field that mp3gain adjusts is an 8-bit unsigned integer, so the possible values are 0 to 255. MOST mp3 files (in fact, ALL the mp3 files I've examined so far) don't go over 230. So there's plenty of headroom on top-- you can increase the gain by 37dB (multiplying the amplitude by 76) without a problem. The problem is at the bottom of the range. Some encoders create frames with 0 as the global gain for silent frames. What happens when you _lower_ the global gain by 1? Well, in the past, mp3gain always simply wrapped the result up to 255. That way, if you lowered the gain by any amount and then raised it by the same amount, the mp3 would always be _exactly_ the same. There are a few encoders out there, unfortunately, that create 0-gain frames with other audio data in the frame. As long as the global gain is 0, you'll never hear the data. But if you lower the gain on such a file, the global gain is suddenly _huge_. If you play this modified file, there might be a brief, very loud blip. So now the default behavior of mp3gain is to _not_ wrap gain changes. In other words, 1. If the gain change would make a frame's global gain drop below 0, then the global gain is set to 0. 2. If the gain change would make a frame's global gain grow above 255, then the global gain is set to 255. 3. If a frame's global gain field is already 0, it is not changed, even if the gain change is a positive number. To use the original "wrapping" behavior, use the -w switch. SEE ALSO
The homepage of mp3gain is located at http://mp3gain.sourceforge.net/ (link to URL http://mp3gain.sourceforge.net/) . AUTHOR
This manual page was written by Stefan Fritsch sf@sfritsch.de for the Debian system (but may be used by others). Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Lesser General Public License, Version 2.1 or any later version published by the Free Software Foundation. On Debian systems, the complete text of the GNU Lesser General Public License can be found in /usr/share/common-licenses/LGPL. MP3GAIN(1)