Page 2 of 2

Posted: 2012-05-16 20:08:09
by soulsnake
Is sounds great! I've just tested it yet. I had to change two reference from STR into SRT wink but it works great!
You are right.
I definitely have some movies split in two files. So yes it has only one movie per folder but sometime there are 2 video files and 2 sub files.
It is OK like this ;).
When you use media import and scan the directory you have the option to assign fields to columns. I've also found the great icons on the right to load and save the field<->column association. Despite the fact that clicking load every time you open the import it's very trivial and quick I think the save settings should be loaded automatically by default. This program it's kind of personal according to the way you set it. Once you found the right association you'll always use them. So I think once this is saved it should be loaded automatically.
If you update the database every e.g. 2 weeks you might forget to click load and import messed up data. Last think you want is inconsistent info in the database. Anything that help preventing this in my opinion is welcome. Do you agree?
Yes!
But for now if you think you will forget to assign good fields to columns, uncheck option "Try to assign fields to columns automatically".
Finally I personally think it makes more sense to have the full size of the movie in the filesize fiels when it comes to movies made by multiple files. So a current 750+750 would be instead a simple 1500. That's easier to read and the "sort by file size" work as it's meant to be wink
You can already do this in Preferences > Movie information > Media files importation > Import size > Make a sum".

Soulsnake.

Posted: 2012-05-17 09:58:37
by rs232
You can already do this in Preferences > Movie information > Media files importation > Import size > Make a sum".
Perfect! The only thing is that what it was already imported is still marked with 750+750. Never mind I'm still at the testing stage I'll make sure this flag is set up before doing the big import.


Going back to the "avoid duplicate movies when importing" idea I have other two points (I'm using 4.11 beta btw):

1) The current file browser to select the directory to scan in media import is not resizeable. Little silly think but you may want to change this.

2) More important: Let's say I have a couple of directories with subdirs in my movie directory I don't really want to import in the database... Perhaps a way to select directories with a flag on the side (include/exclude) would be a good idea to go.
I've found this random image on google that explains exactly what I'm talking about:

http://cdn.guidingtech.com/assets/posti ... tories.png

my 2 cents :)

Posted: 2012-05-18 23:31:02
by soulsnake
Ok, I will see this 2 points when I will have time ;).

Thanks.

Soulsnake.

Posted: 2012-05-19 07:41:29
by rs232
thankyou ;)

Posted: 2012-06-25 22:42:06
by aston10
Hi,

I'm looking for the exact same thing as rs232 but I use a different format for my folder names. I can't quite get my head around the script language so I'd be very happy if I could get some help.


My folder's are named in the following format:
year - original title (english title if any) [720 or 1080 if HD]

For example:
1975 - barry lyndon [720]
1979 - die blechtrommel (the tin drum) [1080]


So I would like to populate all those fields but discard the [720] and [1080] text. Thanks in advance.

Posted: 2012-06-26 15:44:21
by soulsnake
Hi,

The code below should works with all your cases.

Code: Select all

program ParseTitle;

// Parse title like:
// year - original title (tranlated title if any) [720 or 1080 if any]

// For example:
// 1975 - barry lyndon [720]
// 1979 - die blechtrommel (the tin drum) [1080]

var
  Value, TranslatedTitle, OriginalTitle, Year, Resolution: string;

begin
  // Get full title from field Original Title
  Value := GetField(fieldOriginalTitle);
  
  // Extract Year and Original Title
  // [\x00-\x27\x29-\x5A\x5C-\xFF] = all chars excepted '(' and '['
  RegExprSetExec('^([0-9]{4})\s?-([\x00-\x27\x29-\x5A\x5C-\xFF]*)(\(|\[)?.*$', Value);
  Year := Trim(RegExprSubstitute('$1'));
  OriginalTitle := Trim(RegExprSubstitute('$2'));

  // Extract Translated Title
  RegExprSetExec('^.*(\()(.*)(\)).*$', Value);
  TranslatedTitle := Trim(RegExprSubstitute('$2'));

  // Extract Resolution
  RegExprSetExec('^.*(\[)(.*)(\]).*$', Value);
  Resolution := Trim(RegExprSubstitute('$2'));

  //ShowMessage('|' + Value + '|' + ' - |' + TranslatedTitle + '|' + ' - |' + OriginalTitle + '|' + ' - |' + Year + '|' +' - |' + Resolution + '|')
  
  // Put values in fields if they are not empty
  if (OriginalTitle <> '') and (Year <> '') then
  begin
    SetField(fieldOriginalTitle, OriginalTitle)
    SetField(fieldYear, Year)
  end;
  if (TranslatedTitle <> '') then
  begin
    SetField(fieldTranslatedTitle, TranslatedTitle)
  end;
  // If you want to keep resolution in a custom field, uncomment this code and add a custom field (here tag = Resolution) with custom fields manager
  //if (Resolution <> '') then
  //begin
  //  SetCustomField('Resolution', Resolution)
  //end;
end.
Soulsnake.

Posted: 2012-06-30 14:07:00
by aston10
Thanks soulsnake. That worked perfectly!

Posted: 2013-07-26 08:40:01
by KoolPal
soulsnake wrote:
Take you time, I feel already very lucky to have gotten where I'm at the moment
Here is the script to find external subtitles in the folder of movie.
In: field Source to get full path of movie file
Out: field Subtitles with STR and/or SUB value if .srt and/or .sub file has been found for current movie.
I make the assumption that you have one movie by folder.
If you have more than one movie by folder, script need to be modify to search subtitles files with the same name of movie file.

Code: Select all

program FindExternalSubtitles;
var
  Value, FullPath, Path, Subtitles: string;

begin
  // Init subtitles value
  Subtitles := '';
  // Get full path from field Source
  FullPath := GetField(fieldSource);
  // Extrat path from full path
  Path := ExtractFilePath(FullPath);

  // List .str files in directory
  Value := ListDirectory(Path, '*.str');
  // If .str has been found
  if Value <> '' then
  begin
    if Subtitles <> '' then
      Subtitles := Subtitles + ', ';
    Subtitles := Subtitles + 'STR';
  end;

  // List .sub files in directory
  Value := ListDirectory(Path, '*.sub');
  // If .sub has been found
  if Value <> '' then
  begin
    if Subtitles <> '' then
      Subtitles := Subtitles + ', ';
    Subtitles := Subtitles + 'SUB';
  end;
  
  // Write subtitles value in field Subtitles
  SetField(fieldSubtitles, Subtitles)
end.
I like this! If you ask me: I think there's a need to add a "Full path" (including filename as I've found sometime different movies with same filename!!) field to the default database. This field can then be used by media import for the scope you mentioned.
If you decide to go this way can I just add a suggestion? Once the directories are scanned can you list the checked files (to be imported) first? This would simplify the management/identification of new files.
Ok, I will do it.
About just filename or full path, I will make comparison between selected field value and "just filename" of movie found + selected field value and "full path" of movie found. If one of them match, the movie will be unchecked.
In this way user you can store the full path or just the filename in a field in order to make comparison with existing movies and new movies.
I'm sure I'm not the only user of import media ;-) and I guess other users would like this PruneDatabase function to be available somehow. I do like the colours/marking of records to be manually removed, perhaps you may want to reserve a special colour for this so that users can't make mistakes marking a good record as pruned.
Or I can just give the choice to the user of color to use in script option ;).
I think in this thread there's a bunch of good ideas for your next beta release :-)
Yes, and a lot of work... :D
I will try to add these new features to the next release.

Soulsnake.
Sorry to revive an old thread. How do I define which field in the path residing in?

Any other way to update the subtitle field during media import?

Posted: 2013-07-27 12:10:41
by soulsnake
Sorry to revive an old thread. How do I define which field in the path residing in?
Replace fieldSource in script by the field where you store full filepath (e.g. fieldUrl)
You can find all field constants in Help > Technical Information > Script files creation.

Code: Select all

  // Get full path from field Source
  FullPath := GetField(fieldSource); 
Any other way to update the subtitle field during media import?
No sorry.

Soulsnake.

Posted: 2013-07-28 04:26:31
by KoolPal
soulsnake wrote:
Sorry to revive an old thread. How do I define which field in the path residing in?
Replace fieldSource in script by the field where you store full filepath (e.g. fieldUrl)
You can find all field constants in Help > Technical Information > Script files creation.

Code: Select all

  // Get full path from field Source
  FullPath := GetField(fieldSource); 
Any other way to update the subtitle field during media import?
No sorry.

Soulsnake.
Thanks a ton! Now understood and got to work perfectly.