jreklund / php4dvd

php4dvd is an open source php/mysql powered movie database. Catalog your video collection with ease. Automatic update of information and images.
GNU General Public License v3.0
83 stars 43 forks source link

Can I import a CSV file? #34

Closed ghost closed 5 years ago

ghost commented 6 years ago

Hi. At first glance, it is not possible to import a csv file, is this facility available? I already have thousands of DVDs and BluRays in csv format. Many thanks, the software looks great!

jreklund commented 6 years ago

No, there are no import functionality built in. You can however with a brand new system import with CSV if you are using phpMyAdmin.

Required columns are: imdbid name year format

And after that import, you can use the Update all function and it will grab everything from IMDb. Or match the CSV format against all columns.

ghost commented 6 years ago

Thank you, that is ideal for a novice as me. Perhaps in the future an import function will be available that supports the format of the exported file using the existing export function?

jreklund commented 6 years ago

Exporting and importing it's own data aren't really necessary. If you are changing host you usually export/import the complete database.

Importing from other systems are more useful. Is it possible for you to upload your CSV file (just keep like 5 movies in it). And I will have a look on how they structure it.

ghost commented 6 years ago

No, I meant, for people who are not MySQL literate or maybe they do not have phpmyadmin setup would prefer a feature where the database can be exported to CSV, then maybe modified and re-imported with new data.

This could also serve as a quick and easy way to mass add or make mass changes as well as copy out or duplicate all data. Since the exported file will be in a format that is perfect for php4DVD already, there is little chance the import will fail as all fields will be correctly named and ordered.

Another advantage of having a csv file import feature is that it will allow users of other systems, who have already captured a great deal of data, migrate to your awesome platform.

Scenario 1: A user has hundreds of titles already managed, but that user wants to search and replace the string BluRay to Blu-Ray. The user creates exported file, uses Excel or similar to 'search and replace', then when complete, the data is all re-imported without needing to know what columns are required and what format data must be in.

Scenario 2: A user is already using an old MS Access database to manage a large DVD library and wants to migrate to php4DVD. The user creates an export file from the export facility and uses this as a template. The user then creates a merge from their existing MS Access database in to the exported file. The exported file is now populated and can be imported such that php4DVD is the now populated.

I hope I am clear, please let me know if not.

Thanks

jreklund commented 6 years ago

1: As long as no columns have been changed from the time of export and import it should be fairly simple.

2: You need to make a import function that you can map the CSV files headers/columns against the real ones, this one are of course harder to make. As I haven't seen a CSV file from another system I have no idea how they are saving e.g. actors. php4dvd saves new actors on new lines. So it will be hard to import some data, in case they have a complete different structure. So maybe it will only allow some columns to be imported. Others will be ignored and need to be fetched within "Update" (in php4dvd).

thwaller commented 3 years ago

I know this is a close is a closed issue, but I found this while searching for a solution and wanted to add a note for any others that may read this for the same. The information above is not really true anymore. The statement is that the required fields are imdbid, name, year and format. However, if you look at the current database, as of today when I write this, all 37 of the database fields are set to No for NULL, and 27 of those 37 have no default value. For those who may not know, what this means is that none of the fields are allowed to have no value (ie Null). When there is a default value, if no data is passed to populate that field, the default value is used. In this case where there is no default value for most, it is required for the import to pass data to those fields. This means that in order to do an import, a value needs to be passed for the 27 fields that have no default value.

jreklund commented 3 years ago

Thanks for the clarification, those columns I mentioned are the fields that needs to have data or the website won't run. If I remember the code correctly. :)