-2

i need some help on the following topic. I recently created a website streaming media files hosted at Openload.co.

API: https://openload.co/api

On the website media files are available through the embedded video player code provided by Openload which are stored inside a MySQL database table

db.media.embed (Of type text)

<iframe src="https://openload.co/embed/hpPbM8l8rV0/video.mp4" scrolling="no" frameborder="0" width="700" height="430" allowfullscreen="true" webkitallowfullscreen="true" mozallowfullscreen="true"></iframe>

Now the following question:

How to check the files uploaded to my Openload.co account with the embedded code links inside my db´s table and if missing replace the file with the same file reuploaded from a external/local FTP backup source or similar.

I don´t have any existing approach on how to do this so far in code. So i would like to ask here how to deal with it best?

romu
  • 167
  • 1
  • 1
  • 7

1 Answers1

0

If using Python, use the is_file() method of the io module to test if the file exists. Then if it doesn't, have your code fetch the file, maybe using wget if your webserver is running on linux. See:

How do I check whether a file exists using Python?

JasonG
  • 127
  • 1
  • 8
  • Yes i could check for the file id but if the file is missing for e.g how to associate it with the backup file stored locally, there is no file id, only the file it self. – romu Jun 28 '17 at 19:41
  • Did you misread my answer? If you already have the file id, and the file name, you can check the filesystem to see if the file exists. If not, fetch the file from another location to replace the once deleted file. Or am I misunderstanding your question? – JasonG Jun 28 '17 at 19:44