mbruel / ngPost

Command Line (or minimalist GUI) usenet poster for binaries developped in C++/QT designed to be as fast as possible and offer all the main features to post data easily and safely. Releases for Linux, Windows and MacOS are available.
GNU General Public License v3.0
171 stars 33 forks source link

Nzbname and output dir #13

Closed ghost closed 4 years ago

ghost commented 4 years ago

Currently whats keeping me from going full auto with your build in autofunction ist the way nzbnaming is handled. in gui it removes the codec and grpname tag. atleast on a windows platform. i have a structured nzb output which is based on Sections for instance tv/2020-01-28/rlsname.nzb Is there any chance that can be integrated via config file? dont want to use gui, currently im monitoring a base folder per script in that base folder are those sections as dirs. so my script greps the section from dirname of the section dir the upload comes from. basically it would be enough to put nzbs into a seperate folder named by the name of the monitor folder for instance a upload coming from monitored folder /mnt/incoming/linuxisos would be saved in /mnt/nzbs/linuxisos/DATE/ubuntu.1904.nzb

awsms commented 4 years ago

in gui it removes the codec and grpname tag. atleast on a windows platform.

Same issue on Linux with the CLI. Movie.2019.1080p.BluRay.x264.DTS-GROUP.mkv will become Movie.2019.1080p.BluRay.nzb. Maybe it doesn't sound like a big deal, but it's pretty annoying when you're posting several releases of the same movie by different groups; since the new nzb overwrites the previous one.

Btw, I noticed when the input is a single folder, let's say Movie.2019.1080p.BluRay.x264.DTS-GROUP again, the output will be ".nzb" when no output is explicitly given with -o. Shouldn't the output take the name of the folder by default too, like it's done with single files? Edit: it will also be ".nzb" in the history, pretty hard to recognize the password if there are 20 different ".nzb" entries..

ghost commented 4 years ago

Seems to be an error with complete.basename() function

On Wed, Jan 29, 2020 at 1:13 AM awsms notifications@github.com wrote:

in gui it removes the codec and grpname tag. atleast on a windows platform.

Same issue on Linux with the CLI. Movie.2019.1080p.BluRay.x264.DTS-GROUP will become Movie.2019.1080p.BluRay.nzb.

Maybe it doesn't sound like a big deal, but it's pretty annoying when you're posting several releases of the same movie by different groups; since the new nzb overwrites the previous one.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mbruel/ngPost/issues/13?email_source=notifications&email_token=ALXMKFPZKCNCUXTSMS6KNZTRADC3NA5CNFSM4KM3VEV2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKFP3SA#issuecomment-579534280, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALXMKFM6VS5K6LWGHOLNT5TRADC3NANCNFSM4KM3VEVQ .

mbruel commented 4 years ago

Hello, hum.. I didn't noticed that. Well Qt provide both baseName method and completeBaseName methods.

I'm using completeBaseName. From the description it should only remove the last dot with the extension. I'll do some tests, worst case I'll implement my own function, that's not complicated.

Otherwise would you be ok to have the extension? The nzb called: Movie.2019.1080p.BluRay.x264.DTS-GROUP.mkv.nzb? I suppose it would be better than what you have currently...

@r0x0r316 I'm not sure I get what you're asking.. You'd like a separate nzb destination folder per monitoring folder? plus having a date folder? well that's sound quite specific... One per monitoring folder could be done but I don't really see how to set up this in the config file. maybe using an external file cause the config is supposed to be only "key = val" could introduce something like nzbSpecificFolders = /path/to/ngPostNzbFolders.csv and that /path/to/ngPostNzbFolders.csv would have the list of all your monitoring folders a semicolon and then the destination folder. I'd appreciate a contribution if you wish I dev this for you cause I don't think that would be useful for many people... Contact me by email to discuss it further if you'd like.

mbruel commented 4 years ago

Hum I made a test with Movie.2019.1080p.BluRay.x264.DTS-GROUP.mkv and it's seems to work ok fileName: "Movie.2019.1080p.BluRay.x264.DTS-GROUP.mkv" , baseName: "Movie" , completeBaseName: "Movie.2019.1080p.BluRay.x264.DTS-GROUP" , suffix: "mkv" , completeSuffix: "2019.1080p.BluRay.x264.DTS-GROUP.mkv"

Can you give me some full path that have issues. Cheers

PS: which version of ngPost are you using? cause I kind of remember having a baseName instead of completeBaseName in an older version but I could not tell which one. Is it happening with v3.2 or better v4.1?

ghost commented 4 years ago

using the newest one and have some csv for you if like with fucked up paths :D and names and so on :D i trust this stays between us can i mail you the csv? It happens on directories :D not files per se. So if yo have a directory in queue with those dirnames it will remove everything behind the first dot. mon dirnames with spaces like audiobooks or something for instance Marjorie M. Liu - Die Chroniken der Jaegerin 1 - Gefährtin der Dämonen gets cutted to Marjorie M.nzb You can see the difficulty in that i guess :D so my uneducated guess is completebasename doesnt work on dirname with dots in them. Also it seems to have lotsa problems with spaces and special chars like äöü and so on, the csv even looses its format over it. and names and so on get put into speed column. So basically some input cleaning must take place before putting data into csv.string sanitizing.

ghost commented 4 years ago

to the feature request lets move that to a seperate topic i will go into details about it there. Its mainly for organisation and structure purposes. like an nzb archive so to speak. Config options would be ; use_monitor_section use_dated_nzb_dirs

ghost commented 4 years ago

so did some qt research and it seems as if you need to add a little if with the function isDir() and if it is use QDir::dirName() to retrieve the correct nzbname as you wont need to remove extensions from a dirname thats why it works for files as u tested and not for dirnames. i hope this helps you in the near future ill setup QT for myself and can do some bugfixing as the library really looks nice and easy havent progged in c++ in a while but this seems the way to go :) so thanks for using this and hopefully you can resolve the issue faster this way.

mbruel commented 4 years ago

It happens on directories :D not files per se. So if yo have a directory in queue with those dirnames it will remove everything behind the first dot.

Ah ok, that makes sense. for a directory I should take the filename rather than completeBaseName. Ok, I'm going to correct that.

For the other feature, yes please open another issue with a Request title and/or send me an email directly (Matthieu.Bruel@gmail.com)

Also it seems to have lotsa problems with spaces and special chars like äöü and so on, the csv even looses its format over it. and names and so on get put into speed column.

Space shouldn't be a problem. for the accent, I would say it should work but yeah I could remove them all, maybe it's better.

mbruel commented 4 years ago

hope this helps you in the near future ill setup QT for myself and can do some bugfixing as the library really looks nice and easy havent progged in c++ in a while but this seems the way to go :)

yep Qt is a delight to use! I really recommand it to anyone still sticking in C++ for performance reason, memory management and freedom of dev (the OOP is flexible if needed ;))

mbruel commented 4 years ago

@r0x0r316 as you're on Windows, any chance you've access to network shared folder? could you help me with this issue so I could do a release with both fix by the end of the week.

ghost commented 4 years ago

replied in the issue. sadly no network share on the remote box ;)

mbruel commented 4 years ago

I've pushed a fix for the naming of directory and remove the accents.

void NgPost::setNzbName(const QFileInfo &fileInfo)
{
    _nzbName = fileInfo.isDir() ? fileInfo.fileName() : fileInfo.completeBaseName();
    _nzbName.replace(QRegExp("[ÀÁÂÃÄÅ]"), "A");
    _nzbName.replace(QRegExp("[àáâãäå]"), "a");
    _nzbName.replace("Ç","C");
    _nzbName.replace("ç","c");
    _nzbName.replace(QRegExp("[ÈÉÊË]"),   "E");
    _nzbName.replace(QRegExp("[èéêë]"),   "e");
    _nzbName.replace(QRegExp("[ÌÍÎÏ]"),   "I");
    _nzbName.replace(QRegExp("[ìíîï]"),   "i");
    _nzbName.replace("Ñ","N");
    _nzbName.replace("ñ","n");
    _nzbName.replace(QRegExp("[ÒÓÔÕÖØ]"), "O");
    _nzbName.replace(QRegExp("[òóôõöø]"), "o");
    _nzbName.replace(QRegExp("[ÙÚÛÜ]"),   "U");
    _nzbName.replace(QRegExp("[ùúûü]"),   "u");
    _nzbName.replace(QRegExp("[ÿý]"),     "y");
}

If you're aware of any kind of accents I'm missing, please let me know ;)

ghost commented 4 years ago

this one ß might cause problems :D not aware of any others though will test the windows version later on thx for the quick fix :D

mbruel commented 4 years ago

I've just added a last line to remove all unwanted characters: _nzbName.replace(QRegExp("[^A-Za-z0-9\\.,_\\-\\(\\)\\[\\]\\{\\}]"), ""); So basically everything outside a letter, number or .,_-()[]{} will be removed. Is the list too restrictive?

mbruel commented 4 years ago

PS: I'll probably release v4.2 by the end of the weekend. I'm going to focus on adding nice features to the GUI ;)

ghost commented 4 years ago

so basically leave in .-_()[] i think that covers most scene naming conventions

mbruel commented 4 years ago

yeah I've added curly brackets too. I can't think on anything else

ghost commented 4 years ago

me neither :D looks fine to me

mbruel commented 4 years ago

and the coma as I know some people use it for ROMS

ghost commented 4 years ago

yeah and some ebook abook usenetters

ghost commented 4 years ago

btw gui features are nice :D what do u have in mind? as many have requested monitor in there? personally though i like the command line since it was damn easy to just integrate in me already givin infrasructure as soon as the nzbsaving can be switched section/dateddir/nzbname.nzb i will be able to drop my hole script by just one command and some switches.

mbruel commented 4 years ago

yeah I may please the GUI users and add another Tab for the Monitor. then it seems to be an issue with the Save button and the temporary directory that I'll check. and finally, the possibility to close all finished Jobs or to auto close them when finished ;) after that I think the app will be quite complete! I'll be able to move to something else for a while. Later, I'll add the languages support (French and Spanish) and allow people to translate it in whatever language easily. Not sure it is really needed are it's quite basic but I had the requests...

ghost commented 4 years ago

i'll translate into german for ya :D

mbruel commented 4 years ago

I gonna close this issue as it is fixed now. Open a new request thread for the nzb saving but that won't be a priority. Alright cool, I keep it mind for the german ;)

mbruel commented 4 years ago

i'll translate into german for ya :D

Hi man, I'm starting the translation feature, would you have time next week to make the german translation? It will be quite easy to do, I'll prepare an email to explain how to do it. There is a soft to do it. You'll just need to open a file with it and fill each sentence with the german version. Please drop an email (Matthieu.Bruel@gmail.com) so I can send you that file and more explanation. Cheers ;)