26 (edited by derek 2019-06-03 10:10:04)

Re: Movie Oscars database

Hi Darek,
Please see attached with a few posters saved - https://app.box.com/s/l9s19i6grjdw91as50isrd76jbe1n2be
When you have a lot of images, it is better to use the 'linkfile' option to reduce the size of the program  (see attached screenshot).  Also, the 'copy to' option is very useful - if you find your posters from many different locations, 'copy to' takes a copy and stores them all in one place so it is easier to manage.
I've also added a column to the films tablegrid so you can see which films now have posters.
Derek.

Re: Movie Oscars database

hello derek ...

Thank you for your quick response and help.
Unfortunately, I did not really want this option.
I wanted the script to download the poster from the website by clicking on imdb.com or rottentomatoes.com.
After all, thank you very much for your valuable comments and your time and work ...

Greetings
Darek

28 (edited by darek.dorozinski 2019-06-04 06:13:49)

Re: Movie Oscars database

Hello ehwagner...

All the time I am trying to import data into my database from a CSV file using your script and the TCSV class but unfortunately I have errors.
The script incorrectly counts the imported data. You can see it on the example of the movie "A Star is Borne" (as on the attached screenshot!).
I also attach a CSv file from which I am importing. I do not know what is wrong.

Please help.

Greetings
Darek

Post's attachments

Attachment icon Bad_import_data.zip 128.08 kb, 388 downloads since 2019-06-04 

Re: Movie Oscars database

Sorry about that Darek. I forgot to include year when retrieving the id of a film. See attached for the fix.

Post's attachments

Attachment icon oscars with csv import by script_Fixed.zip 856.24 kb, 431 downloads since 2019-06-04 

Re: Movie Oscars database

Hello ehwagner ...

Thank you for your professional and quick help.
Now everything works without charge

Best regards

Darek

Re: Movie Oscars database

Hello, forum members ...

Recently I tried to improve and develop my project a bit

I used the DriveSoft script from the forum: http://myvisualdatabase.com/forum/viewtopic.php?id=1438
automatically creating a copy of the database. therefore

I have several questions:

1. How to make an option to disable or enable a copy of the database using the?

2. I tried to do SPLASH screen but I do not know how? I made a form and I would like it to show up for a limited time and then the program has
     started.

3. Is it possible to improve the algorithm for importing data from CSV and ProgressBar files so that the import is faster?

4. How to use MVD_Scraper.zip from this link: http://myvisualdatabase.com/forum/viewtopic.php?id=1851 to download a picture of the movie poster from imdb.com?

I really care about this option !!!!

5. How to make the color of column headers and calculated fields in the status bar in TableGrid different from the data table?

6. What other statistics can I use in my database next to those that I already have done?

7. How to ensure that after deleting the record there were no empty rows in the database and the next record was added in order?

8. How to add a movie file in * .avi, * .mp4, * .mkv format from a hard disk to the database and play it back?

9. How to do the Trial option so that an unregistered user has limited possibilities of using the program?

10. How to create simple printable reports on the printer?

I attach a packed design with screens

I am asking for help and information

greetings
Darek

Post's attachments

Attachment icon oscars6.zip 1.1 mb, 411 downloads since 2019-06-07 

Re: Movie Oscars database

Hello Darek

2 - First create a form with a TImage to display the picture of your splash.
Then at then begining of your script, declare as variable a TTimer (call it Timer1 - Call it so you can use another timer if you want display time and date with a Timer 2)

Then between BEGIN and END. (at the end of your script), place this pied of code :

    Timer1 := TTimer.Create(nil);                                // Creation of the Timer
    Timer1.OnTimer  := @OnTimer2;                         // Procedure of the event
    Timer1.Interval := 4000;                                       // 4 sec
    Timer1.Enabled  := True;                                     // Lauching of Timer
    Splash.ShowModal;                                            // Displaying splash

At last, create this procedure to release the timer :


procedure OnTimer1(Sender: TObject);                          //  Procedure to close the Splash after 4 sec
begin
     Timer1.Enabled := False;
     Splash.Close;
     Timer1.Free;
end;

9 - Using a trial version :

This code :

procedure Form1_OnShow (Sender: string; Action: string);
var
   reg: TRegistry;
   iDays: integer;
begin
     reg := TRegistry.Create;
     reg.Access := KEY_ALL_ACCESS;
     reg.RootKey := HKEY_CURRENT_USER;
     reg.OpenKey('software\MyVisualDatabaseTrial',true);
     if not reg.ValueExists('StartDate') then reg.WriteDate('StartDate', Now+30); // trial period is 30 days

     iDays := Trunc(reg.ReadDate('StartDate')) - Trunc(Now); // time left days

     reg.CloseKey;
     reg.Free;

     if iDays < 1 then
     begin
          if MessageDlg('Trial period is over.'+#13+' Do you want to visit a order page?', mtInformation, mbYes+mbNo, 0) = mrYes
              then OpenUrl('http://yourpage.com');

          Form1.Close;
          Exit;
     end;

     if MessageDlg('Demo version. Time left: ' + IntToStr(iDays) +' days.'+#13+'Do you want to visit a order page?', mtInformation, mbYes+mbNo, 0) = mrYes
         then OpenUrl('http://yourpage.com');

end;


8 - Read a video file :

procedure Form1_Button5_OnClick (Sender: string; var Cancel: boolean);

begin
    MediaPlayer.FileName := 'c:\oiseaux_new\videos\bruant jaune.mp4';  // Place here your own video file
    MediaPlayer.Open;
    MediaPlayer.Display := Form1.Panel1;
    MediaPlayer.DisplayRect(0, 0, Form1.Panel1.Width, Form1.Panel1.Height);
    MediaPlayer.Play;
end;

procedure Form1_Button2_OnClick (Sender: string; var Cancel: boolean);
begin
     MediaPlayer.Stop;
end;

procedure Form1_Button1_OnClick (Sender: string; var Cancel: boolean);
begin
     MediaPlayer.Pause;
end;


Si on veut lire le fichier en boucle


procedure MediaPlayer_OnNotify (Sender: string);
begin
  if MediaPlayer.NotifyValue=nvSuccessful then
  begin
    //restart the song
    MediaPlayer.Play;
    MediaPlayer.Notify := True;//ensures we are notified when song completes
  end;
end;

I hope this can help you darek
No hesitation if any problem with those pieces of code

JB

Re: Movie Oscars database

Hello jean.brezhonek ...

Thank you very much for your quick response ...
I am just trying to use your scripts.
I understand that you can not help me with the rest of my questions ???
But thank you so much and greetings
Darek

34 (edited by darek.dorozinski 2019-06-09 18:55:31)

Re: Movie Oscars database

Welcome back jean.brezhonek

I did as you suggested in point 2 and spash starts, but I get an error:  Letter index out of bounds (1)!

Unfortunately I do not know why?
Besides, Timer does not work because Form1 does not appear after the scheduled time automatically.

Why?

Unfortunately, I do not understand and I can not use the scripts from point 8 and 9 (Trial version and Read a video file): - (((

If I can ask for help, I will be very grateful I enclose a modified project of my database

greetings
Darek

Post's attachments

Attachment icon oscars6_splash_error.zip 1.11 mb, 406 downloads since 2019-06-09 

35 (edited by derek 2019-06-09 23:11:52)

Re: Movie Oscars database

Hi Darek, Hi Jean,
If you don't want to use TTimer, attached is a different way of doing a splash screen.
Also attached is how to change the BACKGROUND color of the tablegrid column headings.  But note for this to work, you need to change the tablegrid header style to 'hsauto' (if you use the 'hsoffice' header style options, it has no effect) - see screenshot1 in the attachment.
Also note that changing the TEXT color of the tablegrid column headings is not supported. 
I've done these suggestions in a separate program because I didn't want to mess up anything in your Oscars project, but my bits of script can be copied and pasted into yours if needed.
Derek.

Post's attachments

Attachment icon darek splashscreen.zip 664.89 kb, 393 downloads since 2019-06-10 

Re: Movie Oscars database

Hello Darek, Hello Derek

About your splash, I notice somme errors :

Procedure Form1.On show
You used 2 pairs Begin End;
I remove one

For Timer.Interval, you used two different values : 500 and 1000.
I remove 1000

Procedure OnTimer;
You use it to calculate time before to realise a backup of you data.
But this proc is already used to calculate the time you show the splash.;
There is a conflict
For backup your data, use a second Timer (Timer2)
each will have its distinct role

Procedure Form1.Close;
I remove your timer, the origine of your conflict;
Use here another Timer

In all cases, always think about freeing resources (Timer.free)

If any problem to play with this, I will help more

Otherwise, if using diferents Timer can disturb you, please use Derek's solutions

JB

Go on with

37 (edited by darek.dorozinski 2019-06-10 09:21:47)

Re: Movie Oscars database

Hello derek and jean.brezhonek ...

As always, thank you very much for your help and support.
I have already removed the error but the Splash window does not close automatically after the specified time and the next program window will not start.

But when you press the start button, everything works ???
I do not know why ?

Can someone help me solve this problem? I do not know how to deal with the other questions? :

1. How to make an option to disable or enable a copy of the database using the?

3. Is it possible to improve the algorithm for importing data from CSV and ProgressBar files so that the import is faster?

4. How to use MVD_Scraper.zip from this link: http://myvisualdatabase.com/forum/viewtopic.php?id=1851 to download a picture of the movie poster from imdb.com?

I really care about this option !!!!

5. How to make the color of column headers and calculated fields in the status bar in TableGrid different from the data table?

6. What other statistics can I use in my database next to those that I already have done?

7. How to ensure that after deleting the record there were no empty rows in the database and the next record was added in order?

8. How to add a movie file in * .avi, * .mp4, * .mkv format from a hard disk to the database and play it back?

9. How to do the Trial option so that an unregistered user has limited possibilities of using the program?

10. How to create simple printable reports on the printer?

Thank you in advance for your time and valuable remarks.

Regards
Darek

Post's attachments

Attachment icon oscars6_no_autoamtically_start_close_Spalsh.zip 1.11 mb, 547 downloads since 2019-06-10 

Re: Movie Oscars database

Hello Darek
Plesase find in attachment (darek.rar) your project with a splashscrren disappearing after 5 sec
I look after the other questions.
Regards
JB

Post's attachments

Attachment icon Darek.rar 447.22 kb, 395 downloads since 2019-06-10 

Re: Movie Oscars database

Helo bis Darek

About question 5,
do you mean you want a color other than the default one for the head of the grid (gray by default)
If it's just that:
for the head :
procedure Form1_GridEmployees_OnChange (Sender: string);
begin
    Form1.GridEmployees.Columns[0].Header.Color := clYellow;
    Form1.GridEmployees.Columns[1].Header.Color := clRed;
    Form1.GridEmployees.Columns[2].Header.Color := clGreen;
end;

In property Additional of the grid, uncheck item EnableVisualStyles (set it to false)
if there are many columns to color, then use a loop to save time and to avoid using the tips of his fingers

for the footer :
The same way

Also a loop if so many footers
form1.tablegrid1.columns[1].footer.color := clRed;

About Question 8 :
Did you succed with my snipets ?
I use this code in a projetc mad with MVD  1.52 (t's a long, long, long ... time)
This project displays picture of a bird chosen from a combobox and when displaing image, the song is launched.
Works fine !

In another project about managing birds (a kind of encyclopedy), same maner to launch vidéos (avi) about the bird displayed.
It works also fine

In the two projects, songs and videos are stored on hard disk, using property LinkFile and filling in Copy property the path ware they are stored.

What probleme do you meet when you want play a video ?

Regards
JB

Re: Movie Oscars database

Darek,
Attached is an updated project with some of the features you were asking. But some of the questions I wasn't clear on.

1) How to make an option to disable or enable a copy of the database using the?  I don't know what you mean by enable and disable a copy of the database. Maybe explain a little more.

2) Splash screen is working as you like.

3) The import is much faster now.

4) I do not believe that MVD_Scraper is able to do what you want. It is designed to extract information from a specific web page. I'm not sure you can actually manipulate or navigate web pages and click buttons or links with MVD. But I'm not an expert on web scraping. Maybe Mathias or Dimitry can enlighten you more on this subject.

5) Tablegrid headers and footers have different colored background (by script). You cannot make the text a different color.

6) Not sure what else you need.

7) MVD maintains the id's and will always be in order.

8) I provided an example of embedding a video on a form. I wasn't sure if you were intending on maintaining video paths for each film. So I just provided a button to open any video file on disk and show the clip.

9) I put in the code for a trial. Form1 caption will show how many days you have left in the trial period. The trial version allows for complete access to all features for 30 days.

10) I created a simple report for you. The report button is under Tablegrid1.

Post's attachments

Attachment icon oscars6_Revised.zip 901.76 kb, 402 downloads since 2019-06-10 

Re: Movie Oscars database

Hello ehwagner ..

I really do not know what to say !!!
Thank you very much for professional help.

Everything works great. The speed of data import now suits me.
Please write me how did you improve it ??
Regarding issue 1, I would like the user to start the creation of a copy of the database, for example, every specified period of time after starting the program. As on the attached screen.

As for point 6, I would like more statistics in my database, for example: which film won the most nominations, most nominations in the Best Actor, Best Director, Best Pictures etc.

I would like very much to be able to mark in my database which movies I have in my home collections, on which disk and to be able to play them. I do not know how to do it.

Thank you once again and best regards
Darek

Post's attachments

Attachment icon screen11.jpg 222.45 kb, 208 downloads since 2019-06-11 

42 (edited by ehwagner 2019-06-11 21:18:44)

Re: Movie Oscars database

Darek,
I put in BeginSQLiteTransaction and CommitSQLiteTransaction to improve the speed. Basically it does the work in memory and then writes to disk after finishing. While we are on the subject of the import, once you have performed the import once why would you need to do it over again? I don't know what the source of your CSV file is, but it seems to me that there would not be a need to import again until the next Oscar Awards and then you would only want to import the new records. Or the other option would be to use your add and update capability within your project to put in the new records.


This brings up the other issue in your list and that is the backup process. Since your data is basically static till the next Oscars Awards, I think doing backups periodically while the program is open is an overkill. I even think that backing up every time you close the program is an overkill, in my opinion. Unless you are doing updates to it all day long there is no need to do a backup. You would be backing up the same data all the time. I put in code to backup whenever the program closes and you have made changes to your data during the session. I think it's more efficient and you won't have a boat load of backup files that are identical.


I also put in your other statistics. Films with the most nominations, films with the most winners, actors with the most best actor nominations, directors with the most best director nominations. I didn't understand the most Best Pictures. There can only be one Best Picture for a film. Also, keep in mind that the more general statistics you have on your form1, the longer the form may take to load because it's doing a lot of summary processing before showing the numbers..


The last thing you mentioned regarding incorporating other data points for your home collection, etc., I did not do that in the attached project due to my time constraints for right now. I am getting ready to go on vacation. But something to consider if you add fields and update that info through the project, then the full import process will wipe out your manual updates. This is another reason for not doing the full import process after the first time and only import new records when the Oscar Awards occurs the next year.


Hope this helps. Maybe Derek or somebody else can lend a hand from here

Post's attachments

Attachment icon oscars7.zip 904.39 kb, 410 downloads since 2019-06-11 

Re: Movie Oscars database

Hello ehwagner ...

As usual, your help is professional and very fast.
Thank you with all my heart for your time.
You explained and advised me a lot. I have only one question before you go on vacation: How to count the number of all nominations in individual categories, as on the attached screenshot?
If you find the time, I will be grateful. In addition, I wish you a happy and happy holiday.
greetings
Darek

Post's attachments

Attachment icon screen12.jpg 69.47 kb, 200 downloads since 2019-06-12 

44 (edited by derek 2019-06-12 07:59:10)

Re: Movie Oscars database

Hi Darek,
I'd use a calculated field to get the count of nominations in each category.
In your 'categories' table, add a calculated field and attach the following code:
(select count(id) from nominations where nominations.id_categories = categories.id)   
Then add this calculated field to tablegrid1 in Formcat.
Derek.

Post's attachments

Attachment icon oscars6_Revised.zip 906.98 kb, 404 downloads since 2019-06-12 

Re: Movie Oscars database

Thanks a lot derek

You're amazing. :-)

Ok, I'm getting to work on the base of Oscars to hear

my best regards
Darek

Re: Movie Oscars database

Hello everyone ... I

'm working on my Oscars base and I encountered another problem:
I do not know how to set the size of the form to automatically scale to the type of monitor resolution?
Is there any way?
I am asking for help ..

Regards
Darek

Re: Movie Oscars database

Every component has property Anchors

Specifies how the control is anchored to its parent.

Use Anchors to ensure that a control maintains its current position relative to an edge of its parent, even if the parent is resized. When its parent is resized, the control holds its position relative to the edges to which it is anchored.

If a control is anchored to opposite edges of its parent, the control stretches when its parent is resized. For example, if a control has its Anchors property set to [akLeft, akRight], the control stretches when the width of its parent changes.

Dmitry.

Re: Movie Oscars database

Hello Dmitry ...

Now I understand ... thanks a lot ...
Regards
Darek

Re: Movie Oscars database

Hello Dimitry ...

I still need your help! I am looking in the code of my script and I can not find where the number code is Categories: in TableGrid2.
I would also like to display the sum of all prizes won, as on the attached screenshot.

Please help ...
Regards Darek

Post's attachments

Attachment icon screen13.jpg 136.09 kb, 204 downloads since 2019-06-13 

Re: Movie Oscars database

darek.dorozinski wrote:

Hello Dimitry ...
I still need your help! I am looking in the code of my script and I can not find where the number code is Categories: in TableGrid2.

It's not script, number of categories from setting of button8


darek.dorozinski wrote:

I would also like to display the sum of all prizes won, as on the attached screenshot.

Please help ...
Regards Darek

Change procedure Form1_TableGrid2_OnChange in this way:

procedure Form1_TableGrid2_OnChange (Sender: TObject);
var
    i: integer;
    n: integer;
begin
  // The following assigns a color to hearders and footers for Tablegrid2
  Form1.Tablegrid2.Columns[0].Header.Color := $002C8BBA;
  Form1.Tablegrid2.Columns[1].Header.Color := $002C8BBA;
  Form1.Tablegrid2.Columns[2].Header.Color := $002C8BBA;
  Form1.Tablegrid2.Columns[3].Header.Color := $002C8BBA;
  Form1.Tablegrid2.Columns[4].Header.Color := $002C8BBA;
  Form1.Tablegrid2.Columns[0].Footer.Color := $002C8BBA;
  Form1.Tablegrid2.Columns[1].Footer.Color := $002C8BBA;
  Form1.Tablegrid2.Columns[2].Footer.Color := $002C8BBA;
  Form1.Tablegrid2.Columns[3].Footer.Color := $002C8BBA;
  Form1.Tablegrid2.Columns[4].Footer.Color := $002C8BBA;

  n := 0;
  for i := 0 to Form1.TableGrid2.RowCount-1 do
  begin
      if Form1.TableGrid2.Cell[4,i].AsInteger = 1 then Inc(n);
  end;

  Form1.TableGrid2.Columns[4].Footer.Caption := IntToStr(n);
end;
Dmitry.