From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1RVwOG-0007ZH-Dg for garchives@archives.gentoo.org; Thu, 01 Dec 2011 02:28:48 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 48901E0540; Thu, 1 Dec 2011 02:27:55 +0000 (UTC) Received: from mail-qy0-f181.google.com (mail-qy0-f181.google.com [209.85.216.181]) by pigeon.gentoo.org (Postfix) with ESMTP id D167F21C13C for ; Thu, 1 Dec 2011 02:23:42 +0000 (UTC) Received: by qyc1 with SMTP id 1so635434qyc.40 for ; Wed, 30 Nov 2011 18:23:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=m/YFBbmAh0rxnd6jesNlxmLxyh7tIUAOU0W9kEIo4Sw=; b=w6EkQnXFbY3USgw+9Wuobty0zz+6dlgQlvUe4p8++ugRC198AgMDe1jo5raj2xXib7 rCH+M+gQt7wOW8A8kCUWCHbr11yig20yDsct53/kKzizjjJMIQqU0mUvxW5/DIKNg8jd 9y29C+o3kgSLEcLh/RvSrPkxrsTIAqTgKvNXM= Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-user@lists.gentoo.org Reply-to: gentoo-user@lists.gentoo.org MIME-Version: 1.0 Received: by 10.229.11.141 with SMTP id t13mr793144qct.275.1322706222277; Wed, 30 Nov 2011 18:23:42 -0800 (PST) Received: by 10.229.246.134 with HTTP; Wed, 30 Nov 2011 18:23:42 -0800 (PST) In-Reply-To: References: <4ED6DD26.1070604@gmail.com> Date: Thu, 1 Dec 2011 00:23:42 -0200 Message-ID: Subject: Re: [gentoo-user] Changing names of LOTS of files, adding to them actually. From: Francisco Ares To: gentoo-user@lists.gentoo.org Content-Type: multipart/alternative; boundary=0016364eec668564a204b2fe8ad2 X-Archives-Salt: 9bb2e074-8e55-4035-bea5-757547572d28 X-Archives-Hash: e07b02c02c72764089edeec10ca81e90 --0016364eec668564a204b2fe8ad2 Content-Type: text/plain; charset=UTF-8 Sorry, did not read your message to the end. So the sixth line on that script, on your case, instead of: j=`echo $i | sed s/\ \-\ unwantedString//` should be: j="Person of Interest - "$i I guess that's it. You will have to open a console at the directory where your movies are in. Francisco On Thu, Dec 1, 2011 at 12:19 AM, Francisco Ares wrote: > I use the following script to remove parts of downloaded videos, I guess > it wont't be hard to figure out how to change it to your needs. It also > creates a text file with the name of the file and, expecting it to be a > video file, it uses midentify, part of the mplayer package, to read the > duration of the video in a form that LibreOffice is able to import directly. > > > > #! /bin/bash > for i in *unwantedString.??? # it can be a MP4 or a FLV > do > if [ "$i" != "*unwantedString.???" ] # this checks if the list is > empty > then > j=`echo $i | sed s/\ \-\ unwantedString//` > # echo $j > mv "$i" "$j" > fi > done > > for i in *.mp4 *.flv # this removes duplicated file extension > do > if [ "$i" != "*.mp4" ] && [ "$i" != "*.flv" ] > then > j=`echo $i | sed -e s/\.mp4\.mp4/\.mp4/ -e s/\.flv\.flv/\.flv/` > # echo $j > if [ "$i" != "$j" ] > then > mv "$i" "$j" > fi > fi > done > > if [ -e contents.txt ] > then > rm contents.txt > fi > for i in *.mp4 *.flv > do > if [ "$i" != "*.mp4" ] && [ "$i" != "*.flv" ] > then > j=`midentify "$i" | grep ID_LENGTH | cut -d\= -f 2` > k=`echo $i | sed -e s/\.mp4//g -e s/\.flv//g` > echo -e $k \\t 00:00:`echo $j | cut -d\. -f1`,`echo $j | cut -d \. > -f2` >> contents.txt > fi > done > > Hope it helps > Francisco > > > > > On Wed, Nov 30, 2011 at 11:49 PM, Dale wrote: > >> Greets, >> >> I ran into a problem. I been downloading a lot of TV shows. I forgot to >> put a sort of important part in the names. This is what I have with the >> full path: >> >> /data/Movies/TV_Series/Person of Interest/Season 1, Episode 1 - Pilot.mp4 >> >> This is what I need it to be: >> >> /data/Movies/TV_Series/Person of Interest/Person of Interest - Season 1, >> Episode 1 - Pilot.mp4 >> >> Basically, I need to add the name of the show to the name of the file. >> They will all be added to the front of the names. They also almost all >> contain spaces, which means some fancy footwork with the \. >> >> Is there a way to do this? I have room to copy them to another directory >> if needed. I would sort of actually prefer it that way since if it messes >> up, I got the originals at least. >> >> Sorry I'm not real good at gawk, sed and all those things. I suspect >> those will be used tho. I am familiar with | and grep tho. ;-) >> >> Thoughts? >> >> Dale >> >> :-) :-) >> >> -- >> I am only responsible for what I said ... Not for what you understood or >> how you interpreted my words! >> >> >> > > > -- > "If you have an apple and I have an apple and we exchange apples then you > and I will still each have one apple. But if you have an idea and I have > one idea and we exchange these ideas, then each of us will have two ideas." > - George Bernard Shaw > -- "If you have an apple and I have an apple and we exchange apples then you and I will still each have one apple. But if you have an idea and I have one idea and we exchange these ideas, then each of us will have two ideas." - George Bernard Shaw --0016364eec668564a204b2fe8ad2 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Sorry, did not read your message to the end.

<= div>So the sixth line on that script, on your case, instead of:
<= br>
=C2=A0 =C2=A0 =C2=A0=C2=A0j=3D`echo $i | sed s/\ \-\ unwanted= String//`

should be:

=C2=A0 =C2=A0 =C2=A0 j= =3D"Person of Interest - "$i

I guess tha= t's it. You will have to open a console at the directory where your mov= ies are in.

Francisco



On Thu, Dec 1, 2011 at 12:19 AM, Francisco Ares <frares@gmail.com>= ; wrote:
I use the following script to remove p= arts of downloaded videos, I guess it wont't be hard to figure out how = to change it to your needs. It also creates a text file with the name of th= e file and, expecting it to be a video file, it uses midentify, part of the= mplayer package, to read the duration of the video in a form that LibreOff= ice is able to import directly.



#! /bin/bash
for= i in *unwantedString.??? =C2=A0 # it can be a MP4 or a FLV
do
=C2=A0= =C2=A0if [ "$i" !=3D "*unwantedString.???" ] =C2= =A0 # this checks if the list is empty
=C2=A0 =C2=A0then
=C2=A0 =C2=A0 =C2=A0 =C2=A0j=3D`ec= ho $i | sed s/\ \-\ unwantedString//`
=C2=A0 =C2=A0 =C2=A0= =C2=A0# echo $j
=C2=A0 =C2=A0 =C2=A0 =C2=A0mv "$i&qu= ot; "$j"
=C2=A0 =C2=A0fi
done

for i in *.mp4 *.flv =C2=A0# this removes duplicated file extension
do=C2=A0 =C2=A0if [ "$i" !=3D "*.mp4" ] &&= ; [ "$i" !=3D "*.flv" ]
=C2=A0 =C2=A0then
= =C2=A0 =C2=A0 =C2=A0 j=3D`echo $i | sed -e s/\.mp4\.mp4/\.mp4= / -e s/\.flv\.flv/\.flv/`
=C2=A0 =C2=A0 =C2=A0 # echo $j
=C2=A0 =C2=A0= =C2=A0 if [ "$i" !=3D "$j" ]
=C2=A0 = =C2=A0 =C2=A0 then
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0mv "$i" "$j"
=C2=A0 =C2=A0 =C2=A0 f= i
=C2=A0 =C2=A0fi
done

if [ -e contents.txt ]
then
=C2=A0 =C2=A0rm = contents.txt
fi
for i in *.mp4 *.flv
do
=C2=A0 =C2= =A0if [ "$i" !=3D "*.mp4" ] && [ "$i"= !=3D "*.flv" ]
=C2=A0 =C2=A0then
=C2=A0 =C2=A0 =C2=A0 j=3D`midentif= y "$i" | grep ID_LENGTH | cut -d\=3D -f 2`
=C2=A0 = =C2=A0 =C2=A0 k=3D`echo $i | sed -e s/\.mp4//g -e s/\.flv//g`
=C2=A0 = =C2=A0 =C2=A0 echo -e $k \\t 00:00:`echo $j | cut -d\. -f1`,`e= cho $j | cut -d \. -f2` >> contents.txt
=C2=A0 =C2=A0fi
done

Hope it helps
<= div>Francisco

<= div>


On Wed, Nov 30,= 2011 at 11:49 PM, Dale <rdalek1967@gmail.com> wrote:
Greets,

I ran into a problem. =C2=A0I been downloading a lot of TV shows. =C2=A0I f= orgot to put a sort of important part in the names. =C2=A0This is what I ha= ve with the full path:

/data/Movies/TV_Series/Person of Interest/Season 1, Episode 1 - Pilot.mp4
This is what I need it to be:

/data/Movies/TV_Series/Person of Interest/Person of Interest - Season 1, Ep= isode 1 - Pilot.mp4

Basically, I need to add the name of the show to the name of the file. =C2= =A0They will all be added to the front of the names. =C2=A0They also almost= all contain spaces, which means some fancy footwork with the \.

Is there a way to do this? =C2=A0I have room to copy them to another direct= ory if needed. =C2=A0I would sort of actually prefer it that way since if i= t messes up, I got the originals at least.

Sorry I'm not real good at gawk, sed and all those things. =C2=A0I susp= ect those will be used tho. =C2=A0I am familiar with | and grep tho. =C2=A0= ;-)

Thoughts?

Dale

:-) =C2=A0:-)

--
I am only responsible for what I said ... Not for what you understood or ho= w you interpreted my words!





--
"If you have an appl= e and I have an apple and we exchange apples then you and I will still each= have one apple. But if you have an idea and I have one idea and we exchang= e these ideas, then each of us will have two ideas." - George Bernard = Shaw



--
"If = you have an apple and I have an apple and we exchange apples then you and I= will still each have one apple. But if you have an idea and I have one ide= a and we exchange these ideas, then each of us will have two ideas." -= George Bernard Shaw
--0016364eec668564a204b2fe8ad2--