Hyphen in filenames

Get help with all aspects of SABnzbd
Forum rules
Help us help you:
  • Are you using the latest stable version of SABnzbd? Downloads page.
  • Tell us what system you run SABnzbd on.
  • Adhere to the forum rules.
  • Do you experience problems during downloading?
    Check your connection in Status and Interface settings window.
    Use Test Server in Config > Servers.
    We will probably ask you to do a test using only basic settings.
  • Do you experience problems during repair or unpacking?
    Enable +Debug logging in the Status and Interface settings window and share the relevant parts of the log here using [ code ] sections.
Post Reply
User avatar
an3k
Newbie
Newbie
Posts: 31
Joined: June 16th, 2015, 10:49 am

Hyphen in filenames

Post by an3k »

Hello,

earlier versions of Sab allowed me to use a hyphen in the name, eg. "Star Trek- Deep Space Nine" but since a few versions back, everything after the hyphen (including the hyphen) gets removed. How can i get back the old behavior?
User avatar
safihre
Administrator
Administrator
Posts: 5366
Joined: April 30th, 2015, 7:35 am
Contact:

Re: Hyphen in filenames

Post by safihre »

What version of Sabnzbd are you using? And on what operating system?

Do you give the NZB this name, or rename while in the queue?
If you like our support, check our special newsserver deal or donate at: https://sabnzbd.org/donate
User avatar
an3k
Newbie
Newbie
Posts: 31
Joined: June 16th, 2015, 10:49 am

Re: Hyphen in filenames

Post by an3k »

It's 3.6.1 [73e8fad]

I do use NZBDonkey, I assume it uses the API. The problem also exists when renaming while in queue.
User avatar
safihre
Administrator
Administrator
Posts: 5366
Joined: April 30th, 2015, 7:35 am
Contact:

Re: Hyphen in filenames

Post by safihre »

I can't reproduce this on my system.
Could you enable Debug logging on the Status and Interface settings window, then try a rename again, then in the same window click Show Logging.
Send that log to me at [email protected]
If you like our support, check our special newsserver deal or donate at: https://sabnzbd.org/donate
User avatar
an3k
Newbie
Newbie
Posts: 31
Joined: June 16th, 2015, 10:49 am

Re: Hyphen in filenames

Post by an3k »

Logfile sent including some findings.

Because of sorting, everything behind a hypen is treated as "alternative title" and is only included if added with %GI<alternative_title>.

I always used

Code: Select all

%sn/%s. Staffel/%sn.S%0sE%0e.%ext
and it worked fine. Now I would have to use

Code: Select all

%sn- %GI<alternative_title>/%s. Staffel/%sn- %GI<alternative_title>.S%0sE%0e.%ext
to get the same result BUT if the original name doesn't have a hypen one is automatically added.

How do I add a char to the output filename but only if a variable is set (in this case variable %GI<alternative_title>.
User avatar
safihre
Administrator
Administrator
Posts: 5366
Joined: April 30th, 2015, 7:35 am
Contact:

Re: Hyphen in filenames

Post by safihre »

I checked your logs and found the problem similar like you did, you are talking about the Sorting and not the name in the queue.

Back in 3.4 we changed the Sorting algorithm to a much more robust and modern one that can detect much more than the old one.
Here you can see that it sees anything after the hyphen has a series title or alternative title, because that is the standard way files are usually named.
So, since that's quite common, we can't really change that since it would break things for other users.

We don't support a way to remove a space based on another variable.
You could remove the hypen before adding the job, in that case it's detected correctly.
If you like our support, check our special newsserver deal or donate at: https://sabnzbd.org/donate
User avatar
an3k
Newbie
Newbie
Posts: 31
Joined: June 16th, 2015, 10:49 am

Re: Hyphen in filenames

Post by an3k »

Thanks for checking in on my issue!

Quite common? I never (never) saw a nzb posted with a name and alternative title together in the filename. Can you give an example I could search for?
For me, this breaks everything. I normally don't have to manually edit the name. Now I have to. And if I don't a lot is named incorrectly.

If you could add a single function it would solve the problem without adding any to others.

Code: Select all

$if(x,y,z) - if x is true, y is returned, otherwise z.
With that function I could use this and get back the same result as before.

Code: Select all

%sn$if(%GI<alternative_title>,"- %GI<alternative_title>","")/%s. Staffel/%sn$if(%GI<alternative_title>,"- %GI<alternative_title>","").S%0sE%0e.%ext
And other users may find use too, eg. for setting a standard resolution name if the filename doesn't have one $if(%r,"%r","FullHD").

@OneCD This is why sherpa should not automatically update SABnzbd just because of a restart of SABnzbd. At least an option to turn that off is needed.
User avatar
OneCD
Hero Member
Hero Member
Posts: 557
Joined: March 4th, 2017, 3:47 pm

Re: Hyphen in filenames

Post by OneCD »

an3k wrote: October 30th, 2022, 3:01 pm @OneCD This is why sherpa should not automatically update SABnzbd just because of a restart of SABnzbd. At least an option to turn that off is needed.
Ok, I'll include a flag to disable the auto-update during restart when I'm next working on the service script for SABnzbd. I don't know when this will be though. ;D

update: I've created a new issue so I remember to do this: https://github.com/OneCDOnly/sherpa/issues/219
Stuff I like: Apache bash cron DD-WRT Debian DNSMasq Entware FireFox GitHub ImageMagick Kate KDE LibreELEC Netrunner NFS NVIDIA OpenVPN Orvibo-S20 pfSense Python Raspberry-Pi RAID SABnzbd Transmission Usenet VirtualBox Watcher3 XFCE
User avatar
safihre
Administrator
Administrator
Posts: 5366
Joined: April 30th, 2015, 7:35 am
Contact:

Re: Hyphen in filenames

Post by safihre »

This change was made in SABnzbd 3.4, exactly 1 year ago.. So it's not really a recent update at all.
https://github.com/sabnzbd/sabnzbd/releases/tag/3.4.2

Again, I would suggest you add a pre-queue script that just removes the "-" from the job name.

Just a quick example based on the wiki code:

Code: Select all

import sys

try:
    (scriptname, nzbname, postprocflags, category, script, prio, downloadsize, grouplist, showname, season, episodenumber, episodename) = sys.argv
except:
    sys.exit(1)    # exit with 1 causes SABnzbd to ignore the output of this script

print("1")    # Accept
print(nzbname.replace("-",""))
print()
print()
print()
print()
print()

# 0 means OK
sys.exit(0)
If you like our support, check our special newsserver deal or donate at: https://sabnzbd.org/donate
User avatar
an3k
Newbie
Newbie
Posts: 31
Joined: June 16th, 2015, 10:49 am

Re: Hyphen in filenames

Post by an3k »

OneCD wrote: October 30th, 2022, 8:48 pm Ok, I'll include a flag to disable the auto-update during restart when I'm next working on the service script for SABnzbd. I don't know when this will be though. ;D
Thank you very, very much!
safihre wrote: October 31st, 2022, 9:34 am This change was made in SABnzbd 3.4, exactly 1 year ago.. So it's not really a recent update at all.
https://github.com/sabnzbd/sabnzbd/releases/tag/3.4.2

Again, I would suggest you add a pre-queue script that just removes the "-" from the job name.
Yeah, I wasn't updating for a long time until I was forced to because I had to restart my NAS. And then I didn't had time to check what the problem was. I remember that I checked but the changelog doesn't made it very clear what was changed ("Added additional pattern keys that can be used in the Sort String for Sorting, by using the guessit package internally for parsing." isn't saying much).
Sab was working perfectly fine for me ... until I had to update. That's exactly why I don't update except when something is broken.

But thanks for the example code. I just wish Sab would not F around my my stuff except when I tell it to but losing only a hyphen is much better than losing 90% of a movie or tv show title.
User avatar
OneCD
Hero Member
Hero Member
Posts: 557
Joined: March 4th, 2017, 3:47 pm

Re: Hyphen in filenames

Post by OneCD »

an3k wrote: October 31st, 2022, 10:14 am
OneCD wrote: October 30th, 2022, 8:48 pm Ok, I'll include a flag to disable the auto-update during restart when I'm next working on the service script for SABnzbd. I don't know when this will be though. ;D
Thank you very, very much!
Hi @an3k, I've just added this feature to the SABnzbd service-script. You'll need to update your current SABnzbd QPKG to access this ability.

To upgrade:

Code: Select all

sherpa reset
sherpa stop sab
sherpa check
sherpa upgrade sab clean sab start sab
After you've upgraded, you can disable auto-updates with:

Code: Select all

/etc/init.d/sabnzbd3.sh --disable-auto-update
Stuff I like: Apache bash cron DD-WRT Debian DNSMasq Entware FireFox GitHub ImageMagick Kate KDE LibreELEC Netrunner NFS NVIDIA OpenVPN Orvibo-S20 pfSense Python Raspberry-Pi RAID SABnzbd Transmission Usenet VirtualBox Watcher3 XFCE
Post Reply