14 | | This leads me to the conclusion that an extra database for the importer is the best way to do it. The only piece of information that might be worth sharing between both databases is the md5sum of the mp3, so that a possible "play in audioplayer" command will succeed. |
15 | | 2. If the file has to (re)imported, calculate md5sum and extract all other information like artist, title, bitrate, etc. |
| 14 | Conclusion: Indexing information is stored in an extra namespace (http://localhost/skipforward/skipmedia#). That way, it won't be shared by the synching mechanism of SkipForward, but can reside in the same database. The absolute path to the file is normalized to UTF-8 and then used as URI for itself. |
| 15 | 2. If the file has to be (re)imported, calculate md5sum and extract all other information like artist, title, bitrate, etc. |
| 16 | 3. Lookup the song in the database. If import can be done straight forward (because there is no matching Item or exactly one for song and artist), it is passed directly to the actual import process (Step 5). Otherwise, the a reminder is put into a list of files to review manually (Step 4). |
| 17 | 4. If there was doubt on how to import the file, user interaction is required. A GUI is presented where the user has to choose existing items and is able to define the name for each item. These entered information is stored in a special data structure and passed to the import method (Step 5). |
| 18 | 5. There are three types of Items to be imported: |
| 19 | * the song Item itself with title |
| 20 | * the media Item that is a representation of the song |
| 21 | * the artist Items for the main artist and possible contributing artists with their name |
| 22 | In step 3, each of this possible items was searched in the database by title with many possible outcomes: No match found, one match found and multiple matches found. The search ignores the namespace of the items, so the import process needs to distinguish between own and foreign items.[[BR]] |
| 23 | I propose to store the information in Maps<String, Item> where for each entry the key of type String is the itemName of the Item to import. Three cases can occur and are handled as follows: |
| 24 | * The Item value is '''null'''[[BR]] |
| 25 | A new Item is created with the key String as itemName. |
| 26 | * The Item value is an Item of the '''own namespace'''[[BR]] |
| 27 | If the Item already has a matching ItemName with an applicability ''greater than'' 0, it is used. Otherwise, a new ItemName feature is created with the key String as itemName. |
| 28 | * The Item value is an Item of a '''foreign namespace''' |
| 29 | A new Item is created with the key String as itemName and defined identical to the foreign one. (The regular copy-method can't be used because it copies the itemName, too.) |
| 30 | '''Note:''' If a foreign Item is given, it has to be checked if there is an identical own Item to prevent duplicates. |