Torrent Name Fuzzy Matching Help

Discuss and share scripts and script files...
Post Reply
Enternal
Posts: 1175
Joined: 10 Jan 2012 18:26

Torrent Name Fuzzy Matching Help

Post by Enternal »

TorrentMatchup.xys
Whenever I download stuff using torrents, I like to keep the torrent. Generally Torrent file names are similar to the actual file name. For instance:

ThisIsAVideoFile.mkv.torrent -> ThisIsAVideoFile.mkv
The Great Escape.epub.torrent -> The Great Escape.epub

The problem is sometimes (well a lot) I get lazy and have all the torrent files stored all over the place. I want to bring find them all again depending on what files I'm searching for. So if currently I'm trying to find all the torrent files for the following:
File1.mkv
File2.mkv
File3.mkv

I want to do a search that can show up in the Search tab as:
File1.mkv.torrent
File2.mkv.torrent
File3.torrent (The missing mkv is intended)

What I currently did so far is set up a Search Template with Fuzzy of 50%:

Code: Select all

; XYplorer 13.10.0120 configuration file: search template
; Windows 7 Enterprise (Service Pack 1), 64-bit
; 2013-10-23 14:46:51

[Find]
Version=3
Mode=0
FullPath=0
Case=1
InclSubs=1
Inverted=0
Fuzzy=1
FollowFolderLinks=0
SelectedLocations=0
WholeWords=0
AutoSync=1
IgnoreDiacritics=0
FuzzIndex=9
TypeFilter=9
RangeNot=0
StartOfUnit=0
SizeFolders=0
Date=1
DateRange=0
DateNum="1"
DateUnit=3
DateFrom=""
DateTo=""
LeaveEmpty=0
SizeMin=""
SizeMax=""
SizeUnit=1
AttrFindCheck=0
AttrFindNotCheck=0
TagsLabelsText=
TagsTagsText=
TagsCommentText=
TagsLabels=0
TagsTags=0
TagsComment=0
TagsSearchEverywhere=0
ContText=
CaseSens=0
Hex=0
MatchUnicode=0
ContTextInvert=0
ContMode=0
DupesName=1
DupesDate=0
DupesSize=0
DupesContent=0
DupesInvert=0
DupeComparison=1
Mind0=1
Mind1=0
Mind2=0
Mind3=0
Mind4=0
Mind5=0
Mind6=0
Mind7=1

[ExcludeFolders2]
Count=0

[Named]
Named=""

[LookIn]
; True
LookIn=Computer
Save the template as "TorrentMatchup" and then I could then use the script command ::loadsearch "TorrentMatchup". However, currently the name field is empty. I wanted to be able to use the command Input and then paste in the line by line the file names that I want to find the corresponding torrent file for it. How can this be done? The script command loadsearch does not seem to support the ability to directly input filenames so is there a better way than making a separate script that formats my multiline input (that is created from XYplorer's Copy/Path Name button) into the correct single line input with ";" separator and then copy that and put it into the Name field of the Name & Location tab? Or is that the only way?

Code used to format the multiline list:

Code: Select all

  LoadSearch "TorrentMatchup", x;
  $Files = Input("File Names",,,"m");
  $Files = Replace($Files, "<crlf>", ";");
  Text FormatList($Files,"te",";");
Don, do you think it would be nice if you could input a name into the script command loadsearch? Load a template AND input the name to do an immediate search seems like a nice idea. It would definitely make it even more "live" than now. I'm guessing that would also mean an option to overide the current name in the template if it's already there.
To see the attached files, you need to log into the forum.
Last edited by Enternal on 13 Nov 2013 12:23, edited 1 time in total.

highend
Posts: 14942
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Torrent Name Fuzzy Matching Help

Post by highend »

E.g.:

Code: Select all

    $searchTerm = input("Input your search term...", , , , , 600, 100);
    $searchTemplate = <<<>>>
[Find]
Version=3
Mode=0
FullPath=0
Case=1
InclSubs=1
Inverted=0
Fuzzy=1
FollowFolderLinks=0
SelectedLocations=0
WholeWords=0
AutoSync=1
IgnoreDiacritics=0
FuzzIndex=9
TypeFilter=9
RangeNot=0
StartOfUnit=0
SizeFolders=0
Date=1
DateRange=0
DateNum="1"
DateUnit=3
DateFrom=""
DateTo=""
LeaveEmpty=0
SizeMin=""
SizeMax=""
SizeUnit=1
AttrFindCheck=0
AttrFindNotCheck=0
TagsLabelsText=
TagsTagsText=
TagsCommentText=
TagsLabels=0
TagsTags=0
TagsComment=0
TagsSearchEverywhere=0
ContText=
CaseSens=0
Hex=0
MatchUnicode=0
ContTextInvert=0
ContMode=0
DupesName=1
DupesDate=0
DupesSize=0
DupesContent=0
DupesInvert=0
DupeComparison=1
Mind0=1
Mind1=0
Mind2=0
Mind3=0
Mind4=0
Mind5=0
Mind6=0
Mind7=1

[ExcludeFolders2]
Count=0

[Named]
Named=$searchTerm

[LookIn]
; True
LookIn=Computer
>>>;


    $templateName = "TorrentMatchup";
    writefile("<xydata>\FindTemplates\$templateName.ini", $searchTemplate);
    loadsearch $templateName, "rl";
One of my scripts helped you out? Please donate via Paypal

Enternal
Posts: 1175
Joined: 10 Jan 2012 18:26

Re: Torrent Name Fuzzy Matching Help

Post by Enternal »

Oh that's amazing! Thank you! :biggrin:

On a side note, I noticed that Excluded Folders are somehow not retained. The FindTemplates have them show up correctly but when you load them, they don't load (or they don't show up in the Excluded tab anymore). Perhaps this is a bug?

EDIT: Nevermind. My bad. Did not read the parameters closely enough.

Enternal
Posts: 1175
Joined: 10 Jan 2012 18:26

Re: Torrent Name Fuzzy Matching Help

Post by Enternal »

Thank you highend! Anyway, just in case anybody is interested in the code, I have pasted in below. It's simple and there's probably better way of doing what I did with the "Manual" but it works. It will also automatically pull up the "Find Files" tab (Command #260) if it's not already visible. Modify it to fit your needs.

CODE REMOVED. Look at first post.

Post Reply