POSTBUCKET - where random posts in unrelated topics go

Any questions? Need some help?
jchh
Posts: 45
Joined: 02 Nov 2020, 15:13

Re: [SNIPPET] Sort into A-Z folders

Post by jchh »

I got this to work by myself before realising {az} existed, but... it files "Riddick (2013)" into /C/ (presumably because the 1st film was "The Chronicles of Riddick") so I am not sure if this is a bug or not. I would prefer to file it into /R/.

The second snippet works except movies starting with "A" or "The" etc (filing it into /A/ or /T/ respectfully).

The following worked for me:

Code: Select all

{n.replaceFirst(/(?i)(The |A |An |)(.).*/, /$2/)}
jchh
Posts: 45
Joined: 02 Nov 2020, 15:13

Re: [SNIPPET] Sort into A-Z folders

Post by jchh »

...although I'd like to put films starting with a number (eg: 28 days later) into the folder "A-Z". Any tips on how I could incorporate that into my snippet would be appreciated.

[edit]: that was a typo - I'd want to put in into a folder called 0-9
Last edited by jchh on 18 Sep 2021, 16:34, edited 1 time in total.
User avatar
rednoah
The Source
Posts: 22899
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [SNIPPET] Sort into A-Z folders

Post by rednoah »

e.g.

Code: Select all

{ n =~ /^\d/ ? 'A-Z' : n[0] }
:idea: Please read the FAQ and How to Request Help.
jchh
Posts: 45
Joined: 02 Nov 2020, 15:13

Re: [SNIPPET] Sort into A-Z folders

Post by jchh »

that's fantastic - thanks.

how do I either/or that with my snippet?
User avatar
rednoah
The Source
Posts: 22899
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [SNIPPET] Sort into A-Z folders

Post by rednoah »

e.g.

Code: Select all

{ n =~ /^\d/ ? 'A-Z' : n.replaceFirst(/(?i)(The |A |An |)(.).*/, /$2/) }
:idea: Please read the FAQ and How to Request Help.
jchh
Posts: 45
Joined: 02 Nov 2020, 15:13

Re: [SNIPPET] Sort into A-Z folders

Post by jchh »

Brilliant - thanks for your help!
JALinker
Posts: 1
Joined: 07 Nov 2021, 18:17

Re: [SNIPPET] Sort into A-Z folders

Post by JALinker »

Is there a way to sort on names minus "The"?

IE Sorted or filed or renamed as "Big Lebowski, The" as opposed to "The Big..."

Lots of "The" movies in my collection I would rather sort differently...
User avatar
rednoah
The Source
Posts: 22899
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [SNIPPET] Sort into A-Z folders

Post by rednoah »

JALinker wrote: 07 Nov 2021, 18:24 Is there a way to sort on names minus "The"?
:arrow: [SNIPPET] Sort Name
:idea: Please read the FAQ and How to Request Help.
devster
Posts: 417
Joined: 06 Jun 2017, 22:56

Re: [POC] Custom Format Server

Post by devster »

Could this be reworked so that FileBot receives a file name plus information about the type of file and it returns a filename and location?
E.g.

Code: Select all

curl "somethingsomething/post" --data-urlencode "file=${file}" --data-urlencode dir="$(basename ${file})" --data-urlencode output=/Media --data-urlencode label=tv_shows --data @<(mediainfo --full --output=xml "${file}")
and it'd return file destination?
I only work in black and sometimes very, very dark grey. (Batman)
User avatar
rednoah
The Source
Posts: 22899
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [POC] Custom Format Server

Post by rednoah »

devster wrote: 25 Jan 2022, 00:11 Could this be reworked so that FileBot receives a file name plus information about the type of file and it returns a filename and location?
That is what the code above does:

Code: Select all

{ json('http://localhost:8080/'.toURL(f:f, time:System.currentTimeMillis())) }
* pass arbitrary GET parameters (e.g. file path and current time in this specific example)
* pass back the String value returned by the HTTP request to be used as destination path (server response is JSON in this specific example; but you can modify the code to assume a plain text response)
:idea: Please read the FAQ and How to Request Help.
devster
Posts: 417
Joined: 06 Jun 2017, 22:56

Re: [POC] Custom Format Server

Post by devster »

Oh, didn't realize.
But it doesn't seem like FileBot is involved in the remote processing.
This line: const dst = src.toUpperCase().replace(/[^A-Z0-9]/g, '_') is the only piece of code involved in the renaming, right?
I was wondering if it could be made so that FileBot processes the information on the server end (like using an uploaded mediainfo file instead of analyzing the file on disk directly).
I only work in black and sometimes very, very dark grey. (Batman)
User avatar
rednoah
The Source
Posts: 22899
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [POC] Custom Format Server

Post by rednoah »

The server-side code above is just a simple example. This particular example upper-cases one of the GET parameters it was sent as input and sends back the result as output. Your server-side code could do anything though, and your client-side can send arbitrary information, file path, media info, current time, etc.
:idea: Please read the FAQ and How to Request Help.
devster
Posts: 417
Joined: 06 Jun 2017, 22:56

Re: [POC] Custom Format Server

Post by devster »

To expand a bit on this idea, is there a function or an option to use as source file, instead of a media file present on disk, a MediaInfo xml report?

The idea would be to host a FileBot service on a remote server, upload the MediaInfo report file named as the source file and have FileBot return the correct name.
This would not use the move/copy/keeplink functions of FileBot, the xattr bits (although they could be potentially returned in the response or processed from the source), and it would probably require a separate version of amc.groovy which doesn't check folders or file existence.
I only work in black and sometimes very, very dark grey. (Batman)
Xander
Posts: 4
Joined: 13 Mar 2022, 15:42

Re: Q&A for n00bs

Post by Xander »

Hi, RedNoah, and thanks for any/all help you can offer here.

The goal is for TV shows to end up in N:\media\tv and movies to end up in n:\media\moviestowatch. Currently, the first line is working fine but, the infrequent time that I've got a movie to be processed, it works sometimes and, when it doesn't, it deletes the file completely. I'd prefer that movies not get their own subfolder but, if they must, that's not the end of the world.
When qbittorrent finishes, it dumps all files into n:\media\videos for processing.

Secondly, I've added the subtitle clause so let me know if I'm doing that wrong. I'd like the movies to always have a subtitle available.

It's in a batch file that does things like delete .nfo/.txt and other housekeeping things.

Code: Select all

"c:\Program Files\FileBot\filebot.exe" -script fn:amc --output "n:/media/tv" --action move -non-strict "n:/media/videos" --log-file amc.log  --def excludeList=amc.txt --def seriesFormat="{n}/{n} - {s00e00} - {t}" clean=y kodi=kodi:[email protected]:8081

"c:\Program Files\FileBot\filebot.exe" -script fn:amc --output "n:/media/moviestowatch" --action move -non-strict "n:/media/videos" --log-file amc.log --def excludeList=amc.txt --def subtitles=en --def seriesFormat="{n} ({y}) - {rating}" clean=y kodi=kodi:[email protected]:8081
If this can be done with a single line to cover both types of media, I'd love to learn.
Last edited by Xander on 09 Apr 2022, 23:08, edited 1 time in total.
User avatar
rednoah
The Source
Posts: 22899
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Q&A for n00bs

Post by rednoah »

Your structure and customizations seem to make things unnecessarily difficult for yourself. I'd just keep things simple.


e.g. recommended usage:

Code: Select all

filebot -script fn:amc --output "N:/Plex" --action duplicate -non-strict "n:/media/videos" --log-file amc.log --def excludeList=amc.txt
* Clearly separate input / output folders, i.e. input folder must not be inside the output folder.
* Stick to the standard {plex} format, i.e. no custom folder names, no custom formats. The {plex} format is responsible for the "TV Shows" and "Movies" folders. If you choose to use custom formats then your custom format is responsible for generating the parent folder structure within the --output folder if desired.

Xander wrote: 09 Apr 2022, 23:07 If this can be done with a single line to cover both types of media, I'd love to learn.
This is the default behaviour. If all your files are mixed, then a single amc script call is your only option. You can have separate filebot -rename calls (i.e. not amc script calls) for separately processing movie files and episode files, but for that to make sense your files would have to be separated into folders already, one input folder that only contains movies and one input folder that only contains episodes.

:?: What have you tried so far? Where are you stuck? What did the console output say?

:arrow: Please read the amc script manual for details.


:arrow: You'll want to use the suball script on demand for fine-grained control over which files get subtitles. The amc script is a one-size-fits-all solution and thus not suitable if you want subtitles for some files but not others.


:arrow: If you aim to organize the same files into multiple folder structures for easy access, then you'll want to have one well-organized primary structure, from which you can then auto-generate arbitrary secondary structures on demand. Please read Re-organize previously organized files using local xattr metadata for details.
:idea: Please read the FAQ and How to Request Help.
AbedlaPaille
Posts: 107
Joined: 12 Apr 2020, 04:02

Re: How about sharing our format expressions?

Post by AbedlaPaille »

alyssa369 wrote: 04 Mar 2021, 13:11 Looks great. Please let me know how to show folders under some category, (ex. first image). is it a separate magic app or just windows file explorer
Just windows explorer, i created a movie library and added different paths that correspond to the categories i want

https://cdn.discordapp.com/attachments/ ... nknown.png
alittler
Posts: 15
Joined: 14 Jan 2019, 05:04

Re: Q&A for n00bs

Post by alittler »

This thread may been three years old, but I would feel bad asking such a dumb question in it's own thread: my brain may be broked, but qBittorrent doesn't seem to want to run anything. And for the record, "TV_Shows" is merely the alias to my TV Shows drive; Movies_Other is where movies are kept.

This works fine and dandy in the Linux Terminal, but not out of qBittorrent.

Code: Select all

filebot -script fn:amc --output /mnt/TV_Shows --action duplicate -non-strict /home/alittler/Downloads --def movieFormat=/mnt/Movies_Other/{plex} seriesFormat=/mnt/TV_Shows/{plex} --def plex=192.168.1.123:duhhhhhhhhh --def clean=y --def unsorted=y --log-file amc.log --def excludeList=amc.txt 
Thinking I might be misremembering something, I took the AMC script with the output edited, and nothing happened either. The files didn't go anywhere, they weren't copied or anything, and no amc.excludes file. I've checked permissions, I've reinstalled different distros, and installed filebot from different repos, but nothin'.

Code: Select all

filebot -script fn:amc --output "/mnt/TV_Shows" --action duplicate --conflict skip -non-strict --log-file amc.log --def excludeList=amc.excludes --def unsorted=y music=y artwork=y "ut_label=%L" "ut_title=%N" "ut_kind=multi" "ut_dir=%F"
And despite running this, I cannot find the log file

Code: Select all

find /usr/local/filebot-node/ -name "*.log"
wat do
User avatar
rednoah
The Source
Posts: 22899
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Q&A for n00bs

Post by rednoah »

:?: Is filebot called by qBT? What does the log say when filebot is called by qBT and doesn't work?


:arrow: Start by verifying that qBT is actually calling anything, confirm this, and then modify anything to filebot and repeat:
viewtopic.php?t=3067


:idea: If you call filebot with --log-file then the first line of the console output will tell you where the log is. You may want to do --log-file /absolute/path/to/file to specify exactly where you want the file to go, so you know where the file goes.
:idea: Please read the FAQ and How to Request Help.
alittler
Posts: 15
Joined: 14 Jan 2019, 05:04

Re: Q&A for n00bs

Post by alittler »

Well, the printenv command works when I add it to my Terminal script, but not when I paste it into qBT. Which I expected, but also blows chunks. I've installed Filebot dozens of times in my attempts organize my completely legal downloading, in uBT, qBT, and my old Synology NAS, and this has never been a problem.

Despite my best attempts, a crontab just don't work as well as running a script on command.
User avatar
rednoah
The Source
Posts: 22899
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Q&A for n00bs

Post by rednoah »

If you can't run a simple custom shell script unrelated to filebot, then you will not be able to run filebot. Re-installing FileBot has no effect because qBT for some reason seems to just not execute your post-process command.

:arrow: I recommend checking with qBT users in the qBT forums first and see if they can help you debug qBT and see if you can manage to successfully call a simple custom script. Once you've got that confirmed to be working reliably, then we can move on to calling filebot.




EDIT:
alittler wrote: 13 Oct 2022, 04:19 printenv command works when I add it to my Terminal script, but not when I paste it into qBT
You seem to be doing something wrong here, because I'd expect you to copy the path to a custom script into qBT, i.e. just a file path:
rednoah wrote: 09 Oct 2015, 16:48 Step-by-Step Instructions for Beginners:
  1. Download the debug.sh script:

    Code: Select all

    curl -O "https://raw.githubusercontent.com/filebot/plugins/master/bash/debug.sh"
  2. Read the debug.sh script and try to understand what it does line by line:

    Code: Select all

    cat debug.sh
  3. Make the debug.sh script executable for all users:

    Code: Select all

    chmod +rx debug.sh
  4. Enter the absolute path to your /path/to/debug.sh script to execute it:

    Code: Select all

    /path/to/debug.sh
  5. Read the console output for each test command (e.g. printenv > /tmp/printenv.txt) and confirm that each test command is working:

    Code: Select all

    tail /tmp/*.txt
  6. Copy the absolute path to your /path/to/debug.sh script into qBT / Deluge / Transmission / etc and wait for it to be called. Then check the /tmp/*.txt text files to see the console output (i.e. error messages) was for each test command.
:idea: Please read the FAQ and How to Request Help.
alittler
Posts: 15
Joined: 14 Jan 2019, 05:04

Re: Q&A for n00bs

Post by alittler »

Well, it eventually got to work. The issue seems to have been permissions, and using the idea of your debug.sh file, I put my preferred filebot script into a torrent.sh file and made it executable for all users.

I also downloaded about latest Young Sheldon episode about 15,000 times because it was relatively small and had a great amount of seeds.

Thank you kindly, sir.
User avatar
rednoah
The Source
Posts: 22899
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Q&A for n00bs

Post by rednoah »

alittler wrote: 14 Oct 2022, 08:41 I also downloaded about latest Young Sheldon episode about 15,000 times
LOL :lol: :lol: :lol:
:idea: Please read the FAQ and How to Request Help.
cheaters
Posts: 214
Joined: 09 Oct 2016, 02:01

Re: [DOCS] The movie {tags} and movie {edition} bindings

Post by cheaters »

For Plex/Multiple Editions tag... "[" and "]" will not be accepted yet they are built into your tags format. Text in square brackets are ignored.

Plex gives this as the proper format:
/Media
/Movies
Blade Runner (1982) {edition-Director's Cut}.mp4
Blade Runner (1982) {edition-Final Cut}.mp4
I have to use this to make it work with Plex

Code: Select all

{edition-'+tags.toString().replace('[','').replace(']','')+'}'
:?: How to search for "DC" in a filename, coming after a four digit year, and transform that into "Directors Cut" for editions while using plex.id.derive?

Code: Select all

{plex.id.derive{' {edition-'+tags.toString().replace('[','').replace(']','')+'}' }
alittler
Posts: 15
Joined: 14 Jan 2019, 05:04

Re: [SNIPPET] Sort into A-Z folders

Post by alittler »

How would I sort TV shows, by their first letters, into separate drives? Something like this;

Code: Select all

{
	if ({az} =  A..L) {
		return "/media/alittler/'TV Shows'/{plex}"
	} else {
		return "/media/alittler/'TV Shows2'/{plex}"
	}
}
Ah tell you hwat...
alittler
Posts: 15
Joined: 14 Jan 2019, 05:04

Re: [SNIPPET] Sort into A-Z folders

Post by alittler »

alittler wrote: 18 Mar 2023, 13:17 How would I sort TV shows, by their first letters, into separate drives? Something like this;

Code: Select all

{
	if ({az} =  A..L) {
		return "/media/alittler/'TV Shows'/{plex}"
	} else {
		return "/media/alittler/'TV Shows2'/{plex}"
	}
}
Ah tell you hwat...
After a few hours of try and try and try again, I think I got it. I just had to search the Forums the same questions in a few different ways

Code: Select all

Movies_Other/" --action duplicate -non-strict --log-file amc.log --def movieFormat="/media/alittler/Movies_Other/{ plex }" seriesFormat="{n =~ /^(?i)[0-9a-r]/ ? '/media/alittler/TV_Shows_1' : n =~ /^(?i)[s-z]/ ? '/media/alittler/TV_Shows_2'}:/{plex}
" excludeList="/media/alittler/Movies_Other/amc.txt
Post Reply