Page 1 of 1

how to sort the DB by picture?

Posted: 2013-04-01 19:55:10
by rs232
if I right click the list of movies and select sort-by I can't see any option like "Picture"

The reason why I would do such a silly thing is simply because I would like to check what are the movies with no pictures

How can I achieve this?

Regards

Posted: 2013-04-01 23:05:32
by soulsnake
Hi,

You can use a little script like this:

Code: Select all

program SelectNoPicture; // Select movies with no picture or broken picture
begin
  SetSelected(not PictureExists);
end.
or

Code: Select all

program CheckNoPicture; // Check movies with no picture or broken picture
begin
  if PictureExists then
    SetField(fieldChecked, 'False')
  else
    SetField(fieldChecked, 'True');
end.
Soulsnake.

Posted: 2013-04-02 08:31:16
by rs232
HI, thanks for that!
What is it supposed to do if I run the scrip against all the records?
I'm trying but unless I'm something something wrong, it doesn't show me anything

Also... no picture to me means having "something" but perhaps not found.

So in short I'd like to identify empty Picture field and the one that have broken data e.g. pointing to a non existing file.


Appreciated!

Posted: 2013-04-02 08:53:02
by soulsnake
Hi,

I update the post.
Run one of this scripts on all your movies and return to the movie list.
You will have movies selected (or checked, depending of the script you use) if there is no picture or picture doesn't exist.

Soulsnake.

Posted: 2013-04-05 20:17:38
by rs232
Good stuff, it works!

Can we use the same concept for the source field?

That's where I put the full video path.

Ideally a problem with the source would indicate a removed file/directory and that would be very helpful

Thanks!

Posted: 2013-04-06 22:38:39
by soulsnake
Hi,

In the same way, you can use a little script like this:

Code: Select all

program SelectNoFileExists; // Select movies if file stored in source field doesn't exist
begin
  SetSelected(not FileExists(GetField(fieldSource)));
end.
or

Code: Select all

program CheckNoFileExists; // Check movies if file stored in source field doesn't exist
begin
  if FileExists(GetField(fieldSource)) then
    SetField(fieldChecked, 'False')
  else
    SetField(fieldChecked, 'True');
end.
Soulsnake.

Posted: 2013-04-06 23:40:28
by rs232
That's great! Many thanks!!!

On the same line of questions would it be easy/difficult to identify duplicates?

A good example would be identify multiple records with the same e.g. Image or Source or URL field.

Thanks again for the wonderful support!

Posted: 2013-04-07 00:18:51
by soulsnake
Hi,

This is what you want.
The script will select and check movie duplicates by comparing url field.
You can use source field too if you want.
For pictures, if they are stored in catalog, this is more difficult to compare, otherwise you can compare picture path.

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.

Posted: 2013-04-07 12:08:18
by rs232
Amazing! Really... You have no idea how helpful this is to me :-)

thanks again!