bnb wrote:
I just got an iphone finally, and this thread has been great. I am not very good with scripts, so its taken me hours of reading through this thread and I sort of understand it, but I am having a looping issue on the batch file I made. Could someone take a look at mine for me?
set name=%3
set name=%name:"=%
set dirname=%1
set dirname=%dirname:"=%
for /R "%dirname%" %%f in (*.avi) do ffmpeg.exe -y -i "%%f" -f mp4 -vcodec libx264 -level 30 -s 480x272 -r 30000/1001 -b 768k -bt 768k -bufsize 2000k -maxrate 768k -g 250 -coder 0 -acodec libfaac -ac 2 -ab 128k "g:\iphone tv\%name%.mp4" && CALL :tagTVshow "g:\iphone tv\%name%.mp4"
for /R "%dirname%" %%f in (*.mkv) do ffmpeg.exe -y -i "%%f" -f mp4 -vcodec libx264 -level 30 -s 480x272 -r 30000/1001 -b 768k -bt 768k -bufsize 2000k -maxrate 768k -g 250 -coder 0 -acodec libfaac -ac 2 -ab 128k "g:\iphone tv\%name%.mp4" && CALL :tagTVshow "g:\iphone tv\%name%.mp4"
for /R "%dirname%" %%f in (*.wmv) do ffmpeg.exe -y -i "%%f" -f mp4 -vcodec libx264 -level 30 -s 480x272 -r 30000/1001 -b 768k -bt 768k -bufsize 2000k -maxrate 768k -g 250 -coder 0 -acodec libfaac -ac 2 -ab 128k "g:\iphone tv\%name%.mp4" && CALL :tagTVshow "g:\iphone tv\%name%.mp4"
:tagTVshow
REM split down into component parts
FOR /F "TOKENS=1-3 DELIMS=-" %%a in ("%name%") DO set show="%%a"
FOR /F "TOKENS=1-3 DELIMS=-" %%a in ("%name%") DO set seasXep="%%b"
FOR /F "TOKENS=1-3 DELIMS=-" %%a in ("%name%") DO set eptitle="%%c"
REM clean up leading or trailing spaces
SET eptitle=%eptitle:" =%
SET eptitle=%eptitle: "=%
SET eptitle=%eptitle:"=%
SET show=%show:" =%
SET show=%show: "=%
SET show=%show:"=%
REM remove all spaces (and quotes)
SET seasXep=%seasXep:"=%
SET seasXep=%seasXep: =%
REM split down the season and episode number
FOR /F "TOKENS=1-2 DELIMS=xX" %%a in ("%seasXep%") DO set season=%%a
FOR /F "TOKENS=1-2 DELIMS=xX" %%a in ("%seasXep%") DO set episode=%%b
REM now tag the file with this information for iTunes
%AtomicParsley% "g:\iphone tv\%name%.mp4" --overWrite --title "%eptitle%" --genre "TV Shows" --stik "TV Show" --TVShowName "%show%" --TVEpisodeNum %episode% --TVSeason %season%
REM don't repeat the exercise
IF EXIST "g:\iphone tv\%name%.mp4" GOTO :EOF
call cscript "c:\program files\sabnzbd\scripts\itunesupdate.js" "g:\iphone tv"
curl.exe --get "http://192.168.1.103/xbmcCmds/xbmcHttp?command=ExecBuiltIn¶meter=XBMC.updatelibrary(video)"
GOTO :EOF
I just added in: REM don't repeat the exercise
IF EXIST "g:\iphone tv\%name%.mp4" GOTO :EOF
But I obviously didn't do it right, b/c it is doing the same thing.
It loops at this part:
C:\Program Files\SABnzbd>curl.exe --get "http://192.168.1.103/xbmcCmds/xbmcHttp? ... ary(video)"
This version of C:\Program Files\SABnzbd\curl.exe is not compatible with the version of Windows you're running. Check your computer's system information to see whether you need a x86 (32-bit) or x64 (64-bit) version of the program, and then contact the software publisher.
And starts ffmpeg again. It probably has something to do with the GOTO :EOF commands, but I'm not sure how to implement those.
Here is the output: http://pastebin.com/m4f69a59a
Thanks again.
your fix didn't work because the FFMPEG is done on all files in the directory BEFORE it does the tagging. doing something like this should work though
for /R "%dirname%" %%f in (*.avi) do call :mpegit "%%f"
.
.
.
GOTO :EOF
:mpegit
ffmpeg.exe -y -i %1 -f mp4 -vcodec libx264 -level 30 -s 480x272 -r 30000/1001 -b 768k -bt 768k -bufsize 2000k -maxrate 768k -g 250 -coder 0 -acodec libfaac -ac 2 -ab 128k "g:\iphone tv\%name%.mp4" && CALL :tagTVshow "g:\iphone tv\%name%.mp4"
GOTO :EOF
:tagTVshow
REM split down into component parts
FOR /F "TOKENS=1-3 DELIMS=-" %%a in ("%name%") DO set show="%%a"
FOR /F "TOKENS=1-3 DELIMS=-" %%a in ("%name%") DO set seasXep="%%b"
.
.
to better fix the problem, a check to see if the file exists and then adjusting the filename to append a numeric would be neater but I don't have time to show you that. Just bailing out as you've tried should now work.
Cool work! I got it working with slight adjustments.
However, ultimately it would be nice that it fetches metadata automatically from the web from various resources.
There's a java API/CLI program which allows you to do that! it's called tv-and-movies-meta-data-fetcher
What it basically does. It retrieves metadata such as authors, title, description etc from various web resources such as tv.com. That kind of information can in turn be used to tag with Atomic Parsley!
Sorry to dig this thread up again, just was hoping someone could give me an easy fix to a problem I'm having. I think it should be easy anyway...
I have my sabnzbd tv sorting to sort this way:
Series Name/Season #/## - Episode Name
## is the episode number, so 4x05 would be Series/Season 4/05 - Name.avi
sabnzbd sorts the episodes just fine this way, but the converted file is still named the default newzbin standard. What do I need to add to get the file named the way I want?
substyle wrote:
Sorry to dig this thread up again, just was hoping someone could give me an easy fix to a problem I'm having. I think it should be easy anyway...
I have my sabnzbd tv sorting to sort this way:
Series Name/Season #/## - Episode Name
## is the episode number, so 4x05 would be Series/Season 4/05 - Name.avi
sabnzbd sorts the episodes just fine this way, but the converted file is still named the default newzbin standard. What do I need to add to get the file named the way I want?
depends on what you want to call it. A postproc job which will rename any .avi, ,mkv etc files to be the same as the download name is very easy as the download name is passed as a parameter to the PP job.
set name=%3
set name=%name:"=%
set dirname=%1
set dirname=%dirname:"=%
for /R "%dirname%" %%f in (*.avi) do ffmpeg.exe -y -i "%%f" -f mp4 -vcodec libx264 -level 30 -s 480x272 -r 30000/1001 -b 768k -bt 768k -bufsize 2000k -maxrate 768k -g 250 -coder 0 -acodec libfaac -ac 2 -ab 128k "%dirname%\%name%.mp4"
for /R "%dirname%" %%f in (*.mkv) do ffmpeg.exe -y -i "%%f" -f mp4 -vcodec libx264 -level 30 -s 480x272 -r 30000/1001 -b 768k -bt 768k -bufsize 2000k -maxrate 768k -g 250 -coder 0 -acodec libfaac -ac 2 -ab 128k "%dirname%\%name%.mp4"
for /R "%dirname%" %%f in (*.wmv) do ffmpeg.exe -y -i "%%f" -f mp4 -vcodec libx264 -level 30 -s 480x272 -r 30000/1001 -b 768k -bt 768k -bufsize 2000k -maxrate 768k -g 250 -coder 0 -acodec libfaac -ac 2 -ab 128k "%dirname%\%name%.mp4"
echo Removing Originals
cd\iphone
del /S /Q *.avi
del /S /Q *.mkv
del /S /Q *.wmv
I want the episodes renamed to ## - Episode Name (ie no 4x05 stuff, just "05 - Episode Name.mp4")
the code I have is still naming the converted episode "Series Name - 4x05 - Episode Name.mp4" - so I think the name parameter is still set to what newzbin had the report named as, not what my tv sorting sabnzbd settings are. I'm guessing I need to have something that manually strips out the series name, season # and all of that other good stuff, I'm just not sure how to do that and afraid that it could cause problems with legit episodes (such as a number in the episode name?). There has to be an easy way to do it
REM split down into component parts
FOR /F "TOKENS=1-3 DELIMS=-" %%a in ("%name%") DO set show="%%a"
FOR /F "TOKENS=1-3 DELIMS=-" %%a in ("%name%") DO set seasXep="%%b"
FOR /F "TOKENS=1-3 DELIMS=-" %%a in ("%name%") DO set eptitle="%%c"
REM clean up leading or trailing spaces
SET eptitle=%eptitle:" =%
SET eptitle=%eptitle: "=%
SET eptitle=%eptitle:"=%
SET show=%show:" =%
SET show=%show: "=%
SET show=%show:"=%
REM remove all spaces (and quotes)
SET seasXep=%seasXep:"=%
SET seasXep=%seasXep: =%
REM split down the season and episode number
FOR /F "TOKENS=1-2 DELIMS=xX" %%a in ("%seasXep%") DO set season=%%a
FOR /F "TOKENS=1-2 DELIMS=xX" %%a in ("%seasXep%") DO set episode=%%b
then you want the episode and eptitle as your name, so instead of