Advance filter

If you need help on how to use the program
Post Reply
al0203
Posts: 72
Joined: 2013-02-27 05:24:17

Advance filter

Post by al0203 »

How can I make an advance filter with more than one parameter? Something like search the moves with an actor, a director and a category. Something like this. Or to search the movies with two actors.
soulsnake
Posts: 756
Joined: 2011-03-14 15:42:20
Location: France

Post by soulsnake »

Hi al0203,

This is planned for a future release.
For now you can group on actors or directors and take a look.

You can also run a little script to check/uncheck movies you search.
After that you can filter on field "checked" to see results.

For example:

Code: Select all

program Search;
var
  found: Boolean;
begin
  found := true;
  if found then // Search a category
    found := AnsiPosEx('Action', GetField(fieldCategory), True, True) > 0;
  if found then // Search an actor
    found := AnsiPosEx('Bruce Willis', GetField(fieldActors), True, True) > 0;
  if found then // Search a director
    found := AnsiPosEx('Renny Harlin', GetField(fieldDirector), True, True) > 0;
  if found then // Search on movie length
    found := (StrToInt(GetField(fieldLength), 0) > 100);
  if found then // Search on MyRating in a custom field
    found := (StrToInt(GetCustomField('MyRating'), 10) > 4);
  if found then // Check movie if found
    SetField(fieldChecked, 'True')
  else // Uncheck otherwise
    SetField(fieldChecked, 'False');
end.
Soulsnake.
al0203
Posts: 72
Joined: 2013-02-27 05:24:17

Post by al0203 »

soulsnake wrote:Hi al0203,

This is planned for a future release.
For now you can group on actors or directors and take a look.

Soulsnake.
Do you know when is planned to be release the new version?
soulsnake
Posts: 756
Joined: 2011-03-14 15:42:20
Location: France

Post by soulsnake »

Hi,

I am working on the new version during my free time.
The new version 4.2.0 is finalised to 80%.
I planned to release the beta version in 2 weeks, I hope.
But I am not sure if I will have the time to implement the advanced search for version 4.2.0 because I have a lot of work to finalise before, maybe in version 4.2.1.

Soulsnake.
al0203
Posts: 72
Joined: 2013-02-27 05:24:17

Post by al0203 »

soulsnake wrote:Hi,

I am working on the new version during my free time.
The new version 4.2.0 is finalised to 80%.
I planned to release the beta version in 2 weeks, I hope.
But I am not sure if I will have the time to implement the advanced search for version 4.2.0 because I have a lot of work to finalise before, maybe in version 4.2.1.

Soulsnake.
Great. I will try the script.

Thank you.
al0203
Posts: 72
Joined: 2013-02-27 05:24:17

Post by al0203 »

al0203 wrote:
soulsnake wrote:Hi,

I am working on the new version during my free time.
The new version 4.2.0 is finalised to 80%.
I planned to release the beta version in 2 weeks, I hope.
But I am not sure if I will have the time to implement the advanced search for version 4.2.0 because I have a lot of work to finalise before, maybe in version 4.2.1.

Soulsnake.
Great. I will try the script.

Thank you.
I modifyed a bit the Find Duplicates script and now also check/uncheck duplicates

Code: Select all

program FindDup;
uses
  StringUtils1;
var
  MovList: TStringList;
  DupList: TStringList;
  CurTitle: string;
  ResultPath: string;
begin
  if StringUtils1_Version < 3 then
  begin
    ShowMessage('File "stringutils1.pas" is too old, please download a new version of it');
    Error;
  end;
  if ResultPath = '' then
  begin
    ResultPath := 'c:\duplicates.txt';
    Input('Find Duplicates', 'Store results to:', ResultPath);
  end;
  if MovList = nil then
    MovList := TStringList.Create;
  if DupList = nil then
    DupList := TStringList.Create;
  case GetOption('TitleToUse') of
    1:  CurTitle := GetField(fieldOriginalTitle);
    2:  CurTitle := GetField(fieldTranslatedTitle);
    3:  CurTitle := GetField(fieldOriginalTitle) + ' | ' + GetField(fieldTranslatedTitle);
  else
    Error; // wrong option
  end;
  if GetOption('IgnoreCase') = 1 then
    CurTitle := AnsiLowerCase(CurTitle);
  if FindFullLine(CurTitle, MovList, 0) <> -1 then
  
    SetField(fieldChecked, 'True')
  else // Uncheck otherwise
    SetField(fieldChecked, 'False');
    MovList.Add(CurTitle);
  DupList.SaveToFile(ResultPath);
end.
soulsnake
Posts: 756
Joined: 2011-03-14 15:42:20
Location: France

Post by soulsnake »

Here is a simple script to find duplicates by comparing url field ;).

Code: Select all

program FindDuplicates; // Find movie duplicates by comparing url field
var
  List: TStringList;
  Value: string;
begin
  if GetIteration = 0 then
  begin
    List := TStringList.Create;
    List.Sorted := True;
    List.CaseSensitive := False;
  end;
  Value := Trim(GetField(fieldURL));
  //Value := Trim(GetField(fieldSource));
  //Value := Trim(PicturePath);
  if List.IndexOf(Value) > -1 then
  begin
    SetField(fieldChecked, 'True');
    SetSelected(True);
  end
  else
  begin
    List.Add(Value);
    SetField(fieldChecked, 'False');
    SetSelected(False);
  end;
  if GetIteration = GetIterationCount-1 then
  begin
    List.Free;
  end;
end.
Soulsnake.
al0203
Posts: 72
Joined: 2013-02-27 05:24:17

Post by al0203 »

soulsnake wrote:Here is a simple script to find duplicates by comparing url field ;).


Soulsnake.
Can you help me with a script?
I have created two custom fields with integer type call NQV and Visto. I would need a script that check all the movies that have NQV=1 OR Visto=2

Thank you
soulsnake
Posts: 756
Joined: 2011-03-14 15:42:20
Location: France

Post by soulsnake »

Hi,

In the same way than the previous search script, you can write this:

Code: Select all

program Search;
var
  found: Boolean;
begin
  found := true;
  if found then // Search on custom field NQV and Visto
    found := ((StrToInt(GetCustomField('NQV'), -1) = 1) or (StrToInt(GetCustomField('Visto'), -1) = 2));
  if found then // Check movie if found
    SetField(fieldChecked, 'True')
  else // Uncheck otherwise
    SetField(fieldChecked, 'False');
end.
Soulsnake.
al0203
Posts: 72
Joined: 2013-02-27 05:24:17

Post by al0203 »

I modified a bit the Find Duplicates script and now also check/uncheck duplicates. But I´m not able to make it check the two duplicates. Can you help me to check it bouth?

Code: Select all

program FindDup;
uses
  StringUtils1;
var
  MovList: TStringList;
  DupList: TStringList;
  CurTitle: string;
  ResultPath: string;
begin
  if StringUtils1_Version < 3 then
  begin
    ShowMessage('File "stringutils1.pas" is too old, please download a new version of it');
    Error;
  end;
  if ResultPath = '' then
  begin
    ResultPath := 'c:\duplicates.txt';
    Input('Find Duplicates', 'Store results to:', ResultPath);
  end;
  if MovList = nil then
    MovList := TStringList.Create;
  if DupList = nil then
    DupList := TStringList.Create;
  case GetOption('TitleToUse') of
    1:  CurTitle := GetField(fieldOriginalTitle);
    2:  CurTitle := GetField(fieldTranslatedTitle);
    3:  CurTitle := GetField(fieldOriginalTitle) + ' | ' + GetField(fieldTranslatedTitle);
  else
    Error; // wrong option
  end;
  if GetOption('IgnoreCase') = 1 then
    CurTitle := AnsiLowerCase(CurTitle);
  if FindFullLine(CurTitle, MovList, 0) <> -1 then
  
    SetField(fieldChecked, 'True')
  else // Uncheck otherwise
    SetField(fieldChecked, 'False');
    MovList.Add(CurTitle);
  DupList.SaveToFile(ResultPath);
end.
antp
Site Admin
Posts: 9651
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

Post by antp »

I do not think it would be possible to check both, since when the first movie is processed it is not yet possible to know if there is another. So only the 2nd duplicate and next ones can be checked.
al0203
Posts: 72
Joined: 2013-02-27 05:24:17

Post by al0203 »

antp wrote:I do not think it would be possible to check both, since when the first movie is processed it is not yet possible to know if there is another. So only the 2nd duplicate and next ones can be checked.
I think it can't be so complicate. I have thought in to possibilities, but I am not able to make it run.
1) When you look for duplicity movies you generate a variable that content the name of the movie and you incorporate it in a list that you later on save in a file. Why don't you compare the variable with the names of all the movies and check it if it's the same.

Code: Select all

  OtroCurTitle:= GetField(fieldOriginalTitle);
  if GetOption('IgnoreCase') = 1 then
    CurTitle := AnsiLowerCase(CurTitle);
  if FindFullLine(CurTitle, MovList, 0) <> -1 then
  begin
    found := true;
    if found then // Search on Original Title
      found := (GetField(FieldOriginalTitle) = Curtitle);
    if found then // Check movie if found
      SetField(fieldChecked, 'True');

    DupList.Add(CurTitle);
  end
  else
    MovList.Add(CurTitle);
  DupList.SaveToFile(ResultPath);


2) You can compare the varible list with the names of the movies (like when you look for an actor) and if it matchs, check it.
antp
Site Admin
Posts: 9651
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

Post by antp »

Movies are processed one by one.
You can modify it only when you are on that movie.

1. movie title A - not duplicate
2. movie title B - not duplicate
3. movie title A - we already got one, check current movie... but there is no way to say to the script "go back to entry 1"
Or you would have to run the script twice: once to make the list, then to check the movies (but then the script should make a difference between 1st and 2nd run, or else all movies would be duplicates)
al0203
Posts: 72
Joined: 2013-02-27 05:24:17

Post by al0203 »

antp wrote:Movies are processed one by one.
You can modify it only when you are on that movie.

1. movie title A - not duplicate
2. movie title B - not duplicate
3. movie title A - we already got one, check current movie... but there is no way to say to the script "go back to entry 1"
Or you would have to run the script twice: once to make the list, then to check the movies (but then the script should make a difference between 1st and 2nd run, or else all movies would be duplicates)
That's the second option I commented you, comparing all Movies with the list that you generate in DupList and checking the movies that are in the list. Or with the duplicates.txt file. But how can I do it? How can compare a TStringList variable with a field of the db? Or how can I get the information from the duplicates.txt file.
I want to check it all, so when I put the checked filter I see the two at the same time and I can chose witch one to delete.
Last edited by al0203 on 2013-05-17 11:32:19, edited 2 times in total.
antp
Site Admin
Posts: 9651
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

Post by antp »

The script has to know if it is the first run or the 2nd.
Maybe by checking if the list has already be created.
If so, it should load it and instead of filling it it should just compare the titles to those from the loaded list.
al0203
Posts: 72
Joined: 2013-02-27 05:24:17

Post by al0203 »

antp wrote:The script has to know if it is the first run or the 2nd.
Maybe by checking if the list has already be created.
If so, it should load it and instead of filling it it should just compare the titles to those from the loaded list.
Maybe the first option is easear. When you arrive to your step 3., you have the name of the duplicate movie in CurTitle then you tell the computer to check all the files with the same name and it will also check the first one. An then the computer continue tu searching duplicates in the traditional way, but now every time it finds a duplicate it will compare the name of it with all the movies.

Code: Select all

 if FindFullLine(CurTitle, MovList, 0) <> -1 then 
  begin 
    found := true; 
    if found then // Search on Original Title 
      found := (GetField(FieldOriginalTitle) = Curtitle); 
    if found then // Check movie if found 
      SetField(fieldChecked, 'True'); 

    DupList.Add(CurTitle);
al0203
Posts: 72
Joined: 2013-02-27 05:24:17

Post by al0203 »

antp wrote:Movies are processed one by one.
You can modify it only when you are on that movie.

1. movie title A - not duplicate
2. movie title B - not duplicate
3. movie title A - we already got one, check current movie... but there is no way to say to the script "go back to entry 1"
Or you would have to run the script twice: once to make the list, then to check the movies (but then the script should make a difference between 1st and 2nd run, or else all movies would be duplicates)
That's the solution!!, you have to run the search twice in the same script, but the second time you compare with DupList instead of MovList and you eliminate in the second search de lines that incorporate data to MovList or DupList.
al0203
Posts: 72
Joined: 2013-02-27 05:24:17

Post by al0203 »

antp wrote:Movies are processed one by one.
You can modify it only when you are on that movie.

1. movie title A - not duplicate
2. movie title B - not duplicate
3. movie title A - we already got one, check current movie... but there is no way to say to the script "go back to entry 1"
Or you would have to run the script twice: once to make the list, then to check the movies (but then the script should make a difference between 1st and 2nd run, or else all movies would be duplicates)
Finally a did it!!!

Like you said you need to run two scripts. You first run the original Find Duplicates script and after it you have to run this script

Code: Select all

program FindDup;
uses
  StringUtils1;
var
  MovList: TStringList;
  DupList: TStringList;
  CurTitle: string;
  OtroCurTitle: string;
  ResultPath: string;
  found: Boolean;
begin
  if StringUtils1_Version < 3 then
  begin
    ShowMessage('File "stringutils1.pas" is too old, please download a new version of it');
    Error;
  end;
  if ResultPath = '' then
  begin
    ResultPath := 'c:\duplicates.txt';
    Input('Find Duplicates', 'Store results to:', ResultPath);
  end;
  if MovList = nil then
    MovList := TStringList.Create;
  if DupList = nil then
    DupList := TStringList.Create;
  case GetOption('TitleToUse') of
    1:  CurTitle := GetField(fieldOriginalTitle);
    2:  CurTitle := GetField(fieldTranslatedTitle);
    3:  CurTitle := GetField(fieldOriginalTitle) + ' | ' + GetField(fieldTranslatedTitle);
  else
    Error; // wrong option
  end;
  DupList.LoadFromFile(ResultPath);
  if GetOption('IgnoreCase') = 1 then
    CurTitle := AnsiLowerCase(CurTitle);
  if FindFullLine(CurTitle, DupList, 0) <> -1 then
  begin
    SetField(fieldChecked, 'True');
  end
  else // Uncheck otherwise
    SetField(fieldChecked, 'False');


end.


Post Reply