Board: Open.
BAN: Max 5 Scene Requests per time per 24 HOURS! | Mark your topics [FiLLED] after | No Non-Scene Audio Requests
Harassment of any kind not tolerated on the forum. Instant ban.

Tried Sort Files By Group

Track ID's, abuse, or anything else on your minds :)
Post Reply
Pixou59
20 Posts
20 Posts
Posts: 22
Joined: Tue Mar 22, 2022 3:31 pm
Been thanked: 20 times
France

Tried Sort Files By Group

Post by Pixou59 » Tue Feb 14, 2023 3:27 pm

Hi ,

I would like to sort my .nzb files by groups ,

example of files :
Fatima_Hajji-Live_Set_FH_Studio_Madrid_(Maxima_FM)-SAT-09-04-2011-EiTheLMP3.nzb
Fatima_Hajji-Phrenetic_Power_Music-FM-30-12-2011-EiTheLMP3.nzb
Fliterheadz-Live_On_JJJ_The_Club-FM-12-11-2005-DOC_LIVE.nzb
Lollipop_5-Merku_Live-(10-04-2004)-CDR-2004-hM.nzb
Lucien_Foort_-_Live_at_Radio538-08-04-2001-Radio-2001-iPZ.nzb
Mampi_Swift_B2B_Brockie_-_Live_At_One_Nation-2000-sour.nzb
Psiox-Live_at_Zimmer_Frei_Natlab_Eindhoven_(Holland)-LINE-08-27-2011-TWCLIVE.nzb
Tomcraft_-_Great_Stuff_(Proton_Radio)-SBD-06-27-2012-TALiON_INT.nzb
Amitta_Hajji_aka_Fatima_Hajji-Phrenetic_Power_Music-FM-08-06-2012-EiTheLMP3.nzb
DJ_Brockie_Live_at_Master_Mix-1997-sour.nzb
DJ_Orkidea_-_Radio_Unity_26-11-2002-Cable-2002-iPZ.nzb
i tested Ultimate.Scene.Mp3.Sorter.v.1.0.Win7.WinVista-NIGHTRiDER , but it does not support files, only folders

how can i do it please ? TiA

User avatar
Swisha99
500 Posts
500 Posts
Posts: 1341
Joined: Wed Dec 14, 2022 7:34 pm
Has thanked: 36 times
Been thanked: 2115 times
Barbados

Re: Tried Sort Files By Group

Post by Swisha99 » Wed Feb 22, 2023 12:21 am

Rather than run some random executable, here is code to do it yourself.

Install Python - [External Link Removed for Guests]

Save the below to a file sort.py and run it in the directory with your nzb files. Note there is no error checking or handling or anything and use at own risk.... It works fine on the list of files you provided but who knows what may happen if the files have some weird symbols or something in them...

It loops through all files in the directory, checks if the end with the extension specified (nzb in this case), then splits it by hyphen and stores the last portion as the group after remove -INT and _INT. It then makes the group directory if it doesn't exist, and finally moves the files to that folder.

Edit:
Updated to account for INT releases.

Code: Select all

import os
import shutil

ext = ('.nzb') #Set Exsension. ('') for all files

directory = os.getcwd()

for filename in os.listdir(directory):
    f = os.path.join(directory, filename)
    if os.path.isfile(f):
        if f.endswith(ext):
            releasename = os.path.splitext(f)[0] 
            if releasename.lower().endswith('_int'):
                releasename = releasename[:-4]
            if releasename.lower().endswith('-int'):
                releasename = releasename[:-4]
            group = releasename.rsplit('-', 1)[-1]
            groupdir = os.path.join(directory,group,"")
            os.makedirs(os.path.dirname(groupdir), exist_ok=True)
            print("Moving: " + f + " ---> " + group)
            shutil.move(f, os.path.join(directory,group,""))
        else:
            continue    
k=input("press enter key to exit") 
0.png
0.png (47.06 KiB) Viewed 955 times
1.png
1.png (33.31 KiB) Viewed 955 times
2.png
2.png (22.78 KiB) Viewed 955 times

Post Reply

Who is online

Users browsing this forum: Skaterr and 0 guests