Page 1 of 1

[Linux] Move files without stripping Windows "illegal" chars

Posted: 23 Mar 2015, 00:08
by sidcypher
First, this program is FREAKING amazing, and even more so with what the scripting can do..

Haven't ran any linux flavor in years (never used scripts), just installed Ubuntu yesterday and paid for and installed Filebot through Ubuntu Software Center to replace TVrenamer I used on Windows 7.

still knocking the rust off my term skills, just let me know if you need me to run anything or if I left anything out...

Groovy Pad sysinfo

Code: Select all

FileBot 4.5.6 (r2820)
JNA Native: 4.0.0
MediaInfo: MediaInfoLib - v0.7.69
7-Zip-JBinding: OK
chromaprint-tools: fpcalc version 1.1.0 (/opt/filebot/fpcalc)
Extended Attributes: OK
GVFS: OK
Groovy Engine: 2.3.9
JRE: Java(TM) SE Runtime Environment 1.8.0_31
JVM: 64-bit Java HotSpot(TM) 64-Bit Server VM
CPU/MEM: 2 Core / 1 GB Max Memory / 59 MB Used Memory
OS: Linux (amd64)
uname: Linux Beast 3.16.0-31-generic #43-Ubuntu SMP Tue Mar 10 17:37:36 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
transmission-postprocess.sh

Code: Select all

#!/bin/bash
filebot -script fn:amc --output "/run/user/1000/gvfs/smb-share:server=nastysid,share=share/Media/ZeroDay/" --log-file amc.log --action move --conflict override -non-strict --def music=n artwork=y "ut_dir=$TR_TORRENT_DIR/$TR_TORRENT_NAME" "ut_kind=multi" "ut_title=$TR_TORRENT_NAME"
I was trying the above filebot command in term, and it repeated failed because the "ut_dir=$TR_TORRENT_DIR/$TR_TORRENT_NAME" "ut_kind=multi" "ut_title=$TR_TORRENT_NAME" variables weren't being provided by Transmission since it wasn't running the script. (should be a note somewhere that I didn't find about that one, took hours of this and the transmission forum to figure that one out).

amc.log from running in term

Code: Select all

Parameter: music = n
Parameter: artwork = y
Parameter: ut_dir = /
Parameter: ut_kind = multi
Parameter: ut_title = 
Invalid arguments: pass in either file arguments or ut_dir/ut_file parameters but not both
Failure (°_°)
I know ya'll have seen that tons of times, just from digging through these forums.

I was unable to get Transmission to run the script it seemed until I did what plittlefield did here http://www.filebot.net/forums/viewtopic ... t=50#p8524 with the following commands changing ownership and user.. code with changes for my username.

Code: Select all

$ sudo /etc/init.d/transmission-daemon stop
$ sudo nano /etc/init.d/transmission-daemon
  USER=james
$ sudo chown james /etc/transmission-daemon/*
$ sudo chown -R james /var/lib/transmission-daemon/
$ sudo /etc/init.d/transmission-daemon start
Ubuntu doesn't install the daemon by default so I had to install the daemon prior to Paullys changes.

Code: Select all

sudo apt install transmission-daemon

amc.log with Transmission running script using --action test
realized I had the wrong path for my circumstances

Code: Select all

Parameter: music = n
Parameter: artwork = y
Parameter: ut_dir = /home/james/Downloads/NCIS.S12E17.HDTV.x264-LOL.mp4
Parameter: ut_kind = multi
Parameter: ut_title = NCIS.S12E17.HDTV.x264-LOL.mp4
Input: /home/james/Downloads/NCIS.S12E17.HDTV.x264-LOL.mp4
Group: [tvs:ncis] => [NCIS.S12E17.HDTV.x264-LOL.mp4]
Rename episodes using [TheTVDB]
Auto-detected query: [NCIS]
Fetching episode data for [NCIS]
Fetching episode data for [NCIS: Los Angeles]
Fetching episode data for [NCIS: New Orleans]
Stripping invalid characters from new path: TV Shows/NCIS/Season 12/NCIS - S12E17 - The Artful Dodger
[TEST] Rename [/home/james/Downloads/NCIS.S12E17.HDTV.x264-LOL.mp4] to [b][/run/user/1000/gvfs/smb-shareserver=nastysid,share=share/Media/TV/TV Shows/NCIS/Season 12/NCIS - S12E17 - The Artful Dodger.mp4]
[/b]Processed 1 files
Done ヾ(@⌒ー⌒@)ノ
amc.log from Transmission running script without --action test fixed path

Code: Select all

Parameter: music = n
Parameter: artwork = y
Parameter: ut_dir = /home/james/Downloads/NCIS.S12E17.HDTV.x264-LOL.mp4
Parameter: ut_kind = multi
Parameter: ut_title = NCIS.S12E17.HDTV.x264-LOL.mp4
Input: /home/james/Downloads/NCIS.S12E17.HDTV.x264-LOL.mp4
Group: [tvs:ncis] => [NCIS.S12E17.HDTV.x264-LOL.mp4]
Rename episodes using [TheTVDB]
Auto-detected query: [NCIS]
Fetching episode data for [NCIS]
Fetching episode data for [NCIS: Los Angeles]
Fetching episode data for [NCIS: New Orleans]
Stripping invalid characters from new path: TV Shows/NCIS/Season 12/NCIS - S12E17 - The Artful Dodger
[MOVE] Rename [/home/james/Downloads/NCIS.S12E17.HDTV.x264-LOL.mp4] to [b][/run/user/1000/gvfs/smb-shareserver=nastysid,share=share/Media/ZeroDay/TV Shows/NCIS/Season 12/NCIS - S12E17 - The Artful Dodger.mp4][/b]
[MOVE] Failed to rename [/home/james/Downloads/NCIS.S12E17.HDTV.x264-LOL.mp4]
IOException: Failed to create folder: /run/user/1000/gvfs/smb-shareserver=nastysid,share=share/Media/ZeroDay/TV Shows/NCIS/Season 12
Finished without processing any files
Failure (°_°)
I am guessing that it may have something to do the with path, or path ownership.. or something along those lines..
The path I got directly from filebot, which allowed to use a Nautilus bookmark that turns into this long complex path when it shows in filebot.
My Episode Format

Code: Select all

/run/user/1000/gvfs/smb-share:server=nastysid,share=share/Media/TV/{n}/{'Season '+s}/{n} {s00e00} - {t}
I used to use the ZeroDay for my Completed download dump folder since it is part of my DLNA server.. Then I would rename once I had watched whatever.. I would like to continue to use it as such.

I know as the script runs now it will created more folders than I want..
  • share/Media/ZeroDay/TV Shows/NCIS/Season 12/NCIS - S12E17 - The Artful Dodger.mp4
but I am somewhat confidant I can solve that as well

Right now I just want help getting the script to work.. I have downloaded the same episode like 5 times now testing it..

On a side note, is there something for Linux that can keep track airdates of the shows I want, and auto add a torrent to transmission once it is available letting Filebot take over from there?

Re: Transmission runs AMC script and fails.

Posted: 23 Mar 2015, 06:42
by rednoah
Kudos on a very thorough and complete support request! :D

So I guess you want to address this issue here?

Code: Select all

IOException: Failed to create folder: /run/user/1000/gvfs/smb-shareserver=nastysid,share=share/Media/ZeroDay/TV Shows/NCIS/Season 12
Finished without processing any files
The path might look odd, but it's just Gnome Virtual FS doing it's job. It's perfectly valid Linux path.

It's a permission issue. Which are always a bit tricky and there's a plentitude of causes and potential fixed, so Google is your best friend here.

Bottomline, filebot does not have permissions to create new folders on this remote filesystem. Maybe chmod will help? Or chown? Or bad default umask? Depends on who is executing filebot in the first place.

NEVER test filebot in a production environment. You can easily test filebot call from console. Please read the Troubleshooting section for the amc script • Automated Media Center • first. If it works from console but not when called automatically, then you know it's run as a different less privileged user.

You can have your torrent client run filebot -script fn:sysenv and then you'll see who is executing filebot (among lots and lots of other environment variables).

Re: Transmission runs AMC script and fails.

Posted: 23 Mar 2015, 23:36
by sidcypher
Nothing pops up or generates a Iog.. like this in a executable script called test.sh

Code: Select all

#!/bin/bash
filebot -script fn:sysenv
And got a log file this time..

Code: Select all

#!/bin/bash
filebot -script fn:sysenv --log-file test.log
Don't understand 95% of it, but I did see user: james more than once in the file.. so it is running it as me.. not posting it because it is really really long, if you want it let me know and I will post it.


I didn't even think about it until I read your post..
When using the gui I will get an error on every single file since it is trying to copy to the nas

Image

Relating to the : in

Code: Select all

/run/user/1000/gvfs/smb-share:server=nastysid,share=share/Media/TV/{n}/{'Season '+s}/{n} {s00e00} - {t}
It is being changed automatically in the script to

Code: Select all

/run/user/1000/gvfs/smb-shareserver=nastysid,share=share/.....
the script is not automatically forcing the path.. and instead trying to validate the path by removing the : from the actual path...

Also.. filebot/ubuntu combo REALLY doesn't like Agents of S.H.I.E.L.D. because the folder name ends in period, how would I go about changing just the show folder and file name to Agents of SHIELD? Something like this?

Edited below code, to the actual functioning format

Code: Select all

/run/user/1000/gvfs/smb-share:server=nastysid,share=share/Media/TV/{n.replaceAll(/[.]/)}/{'Season '+s}/{n.replaceAll(/[.]/)} {s00e00} - {t}

Re: Transmission runs AMC script and fails.

Posted: 24 Mar 2015, 06:35
by rednoah
Just click Continue instead of Validate.

If you're using the CLI you can do the same by adding -unixfs to the cmdline.

You can also lunch the GUI with filebot -unixfs which will disable these warnings.

Re: Transmission runs AMC script and fails.

Posted: 25 Mar 2015, 19:43
by sidcypher
Rednoah,

You're awesome!

Adding -unixfs to the script command fixed everything

Re: [Linux] Move files without stripping Windows "illegal" c

Posted: 26 Mar 2015, 03:33
by rednoah
Keep in mind that you will now also be able to rename files to something illegal on Windows/Mac so if you run into issues you can still replace those characters via your format.