New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix for national characters #1227
Conversation
Checks for KeyError looking for key 'torrent-added' to make sure that the success result is not caused by something other than a torrent being added, for example a duplicate torrent with {u'arguments': {u'torrent-duplicate': … instead of {u'arguments': {u'torrent-added':… Removed loop in getTorrentFolder to allow calling searher.py to continue searching for next torrent. Earlier the thread was stuck waiting for the percentage to become more than 0 percent complete, which may frequently never happen if no seeders are online. I could not figure out why the loop was needed since the torrent_folder_name is set the line above the loop. Have not had any problems yet forcing me to retry every five seconds like in the loop.
The two instances of torrent_folder_name can be different - if the torrent hasn't started then torrent_folder_name will be the torrent name which will then be overridden with the torrent folder when the torrent has started. Most of the time these will be the same but sometimes they're not and the post processor does not work without this fix.
Hope that it all works now. Only negative side effects I found with this fix is that if a torrent currently downloading in Transmission is manually deleted there, Headphone will log a warning (which is good), but the warning contains the torrent hash instead of a more friendly album name. |
Hi lindhor, your torrent code is working well for me. In the case where the torrent is manually deleted, maybe you could return the name as well as the hash from addTorrent, and then append hash: xxxxxxxx to the name in searcher and then in postprocessor your code could be: if hash: in foldername, torrent_name, hash = foldername.split(hash:), use the hash to get the folder and if that fails use the name and if that fails use the name for the warning. Also, might be an idea to have the same logic for manual postprocessing - where the user has Forced postprocessing |
Thanks, 27 okt 2013v43 kl. 11:19 skrev AdeHub notifications@github.com:
Roger Lindholm Frösundaviks Allé 15, 4tr |
I too am a rookie with Python but been using hp for a while. I changed your logic a little, what do you think?
In postprocessor there is a forcePostProcess function which is called from Manage, Force Post Processing (?). This can be actioned by the user and could be called before the auto processing runs (e.g user may set large scan interval) |
I think your new suggested logic makes sense, it is clearer than mine. Have you implemented it in code somewhere or do you want me to do it? Regarding the forcePostProcess-functionality you mentioned needed change of logic in a similar way, I can’t see why it would need to be changed. It does not talk to Transmission (neither via name nor hash) and thus does not have the problem of getting stuck in a loop if the torrent does not have any seeders. I’m probably missing something here… 28 okt 2013v44 kl. 23:45 skrev AdeHub notifications@github.com:
Roger Lindholm Frösundaviks Allé 15, 4tr |
Following taken from lindhor's pull with a few small changes in pp rembo10#1227 - do not wait for torrent to start to get folder name (e.g. will not start if no seeders or waiting in queue) - return torrent name and hash when adding torrent, append hash to name in searcher for snatched record (torrent name can be different to actual folder name, so we'll use the hash to get the folder in pp. Using hash instead of id as it persists) - pp, use hash to get folder from transmission + Small change to xld processing to determine lossless
Hi lindhor, I've put the code in if you want to check it out: |
Hello, The only issue I have with your latest version is with national characters, in my case primarily the Swedish characters ÅÄÖåäö (running Headphones on Mac OSX with locale UTF-8). Like in: I can solve this by removing non-ascii characters from the term variable during logging by changing to the following line in searchTorrent (and the same for term in two places in searchNZB - line 364 and 233). This makes searcher continue searching for next album. This fix does however NOT make the searcher able to find the torrent via Pirate Bay. For that to work the search URL would need to have national characters translated. I could also do it earlier in the code where term is initially set, but I don’t understand what consequences that would have. I have not had time to look into what’s the best way to solve this yet. One way that seems to do the trick for torrents in searcher is to change line 801 in searchTorrent and ERROR:lib.apscheduler.scheduler:Job "headphones.postprocessor.checkFolder (trigger: interval[0:01:00], next run at: 2013-11-21 01:27:13.151030)" raised an exception Changing lines from Does not help… Then we have similar problems with searchNZB... Obviously I’m doing it the wrong way and are missing something.
If you know anything about the logic behind all of this or have any suggestion on how to change this in the correct way, please let me know... Best regards 2 nov 2013v44 kl. 04:13 skrev AdeHub notifications@github.com:
|
Seems to me Pirate Bay search works with national characters, e.g. if I Edit Search Term to be 'Thåström Fanfanfan' then it finds, if I change it to be 'Thastrom Fanfanfan' then it doesn't. After downloading I get the same pp errors, not sure on those functions either, probably need rembo to have a look |
You're right. Then I guess the problem with the PB search in my experience is that torrents are often added with national characters translated manually into ASCII, using the same rules as in helper.latintoascii. Would it be possible to add an option that allows searchers to search for both the original term with national characters AND search for a ascii translated term? Roger Lindholm Frösundaviks Allé 15,4tr
|
@AdeHub What do we do with this one? |
Hi, I think the problem with Unicode characters still exist. I haven't tried the latest updates during summer and is currently on vacation without computer. I remember someone making major updates during the spring related to national characters and after that it got better. In the later releases after that the only change I had to do locally to make it work was adding the following to the second line of each related source files (don't remember which until I have a computer nearby...) -- coding: utf-8 --Hälsar / Best regards Roger Lindholm POSTADRESS Box 38, 745 21 Enköping, Sweden TELEFON +46 171- 47 02 00
|
@lindhor There are still character encoding issues in HP yes, but AdeHub already made some fixes. So for me it's unclear if this PR is still relevant. What about the other commit "Fix for Duplicate Torrent"? |
Fix for duplicate torrents has already been included in the "major" fix during spring I talked about. For me it's no longer an issue. For national characters I would recommend against my fix, I think it's obsolete. I would however advice to include a new better fix like the the second line directive changing default encoding from ASCII to utf-8. Hälsar / Best regards Roger Lindholm POSTADRESS Box 38, 745 21 Enköping, Sweden TELEFON +46 171- 47 02 00
|
Had trouble with exception that was caused by national characters in the term. This fix solved the issue for me.