Opened 20 years ago
Closed 19 years ago
#303 closed enhancement (fixed)
Some code to guess the category of an insert cd/dvd
Reported by: | anonymous | Owned by: | danielk |
---|---|---|---|
Priority: | minor | Milestone: | 0.20 |
Component: | mythtv | Version: | head |
Severity: | medium | Keywords: | |
Cc: | Ticket locked: | no |
Description
Attached is a small patch that tries to figure out the category of data present on a cd/dvd. The idea is to use this info to atomatically start the right plugin when a cd/dvd is inserted.
Attachments (4)
Change History (19)
by , 20 years ago
Attachment: | DetectMediaType.diff added |
---|
comment:1 by , 20 years ago
comment:2 by , 20 years ago
Mind tweaking this to not use static lists and pull it from the database instead?
comment:3 by , 20 years ago
Milestone: | → 0.19 |
---|---|
Owner: | changed from | to
Status: | new → assigned |
comment:4 by , 20 years ago
Not at all. But currently there is no table with these extensions. Well, mythvideo has 'videotypes', that might be used. We could create audiotypes, gallery types etc... Another option is to create a table that maps suffixes to a media category, more or less the data of the now static array but stored in the database.
Suggestions?
comment:5 by , 20 years ago
Would it be of any benefit to use some system-supported mapping of extensions to MIME types (maybe system() out the "file -i" command?) and then use the MIME major type ("text/", "video/", "audio/", "image/", "application/") to map to the appropriate module for handling that type of media?
comment:6 by , 20 years ago
Using file(1) the time used on a CD with mp3-file is 28sec! There were 155 mp3 files on this disk. I also have dvd's with mp3's. Extrapolating the previous, this will take about 3 minutes to scan. Only retrieving the filenames takes about 1/5 second on the 155 mp3 files.... That's why I used the extension ;-)
comment:7 by , 20 years ago
I didn't mean that file(1) necessarily had to be used; only that it might be a good idea to use MIME types instead of custom internal enumerations; and if we use MIME types, then it would probably be of some benefit to see if there isn't something that's usable to determine the MIME type from the extension. If there isn't something that can be (efficiently) used, I'd still recommend internally mapping extensions to MIME types instead of custom enumerations.
by , 20 years ago
Attachment: | extensions-mythtv.diff added |
---|
extend REG_MEDIA_HANDLER to handle extensions (mythtv-part)
by , 20 years ago
Attachment: | extensions-plugins.diff added |
---|
extend REG_MEDIA_HANDLER to handle extensions (mythplugins-part)
comment:8 by , 20 years ago
I added 2 new diff-files that together implement the extension registration by adding an extra argument to REG_MEDIA_HANDLER(). The bulk of the code also moved from mythcdrom.cpp to mythmedia.cpp...
The first pach is obsolete by now...
comment:9 by , 20 years ago
Owner: | changed from | to
---|---|
Status: | assigned → new |
comment:10 by , 20 years ago
Milestone: | 0.19 → 0.20 |
---|---|
Version: | → head |
jdonovan, this was reassigned by 'anonymous' to Isaac.. I'm leaving to you to reassign
comment:11 by , 20 years ago
The function void MythMediaDevice::DetectMediaType(void) has a bug. It does not reset the value of 'score'. At the head of the code block in the for-loop:
for (em = ExtensionMapList.first(); em; em = ExtensionMapList.next())
The statement 'score = 0;' should be added.
I can generate a new diff on request, but I think the above will suffice for now.
comment:12 by , 19 years ago
Owner: | changed from | to
---|
comment:13 by , 19 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
(In [10095]) Closes #303. Enhances media detection by looking at file name extensions with modified patch from Leo Weppelman.
If we can't detect a type other than "DATA" by any other means (such as used for DVDs and CDs), then with this patch we look at the file extensions, and select the media handler which will handle the greatest number of files on the device.
For example we count things such as "gif,jpg,png" and "ogg,mp3,aac,flac" and use the one with the highest file count to select mythgallery or mythmusic, resp. (This is assuming both media plugins are present.)
BTW This is surprisingly fast for the photo cd's I have laying around.
NOTE: This changes the MYTH_BINARY_VERSION, so plugins must be recompiled and installed after you've installed the updated mythtv libs.
comment:14 by , 19 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
Only works with Photo-CD's. It doesnt'matter which CD I insert, mythgallery is used as handler.
See also #1921
Sorry, it was not my intention to file this anonymous. I'm responsible for this piece of code ;-)