00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00031 #ifdef HAVE_CONFIG_H
00032 #include "autoconfig.h"
00033 #endif
00034
00035 #include "fallback_layout.h"
00036 #include "content_manager.h"
00037 #include "config_manager.h"
00038 #include "metadata_handler.h"
00039 #include "string_converter.h"
00040 #include "tools.h"
00041
00042 #ifdef HAVE_LIBDVDNAV
00043 #include "metadata/dvd_handler.h"
00044 #endif
00045
00046 #ifdef ONLINE_SERVICES
00047
00048 #include "online_service.h"
00049
00050 #ifdef YOUTUBE
00051 #include "youtube_content_handler.h"
00052 #include "youtube_service.h"
00053 #endif
00054
00055 #ifdef WEBORAMA
00056 #include "weborama_content_handler.h"
00057 #endif
00058
00059 #ifdef SOPCAST
00060 #include "sopcast_content_handler.h"
00061 #endif
00062
00063 #ifdef ATRAILERS
00064 #include "atrailers_content_handler.h"
00065 #endif
00066
00067 #endif//ONLINE_SERVICES
00068
00069 using namespace zmm;
00070
00071 void FallbackLayout::add(Ref<CdsObject> obj, int parentID, bool use_ref)
00072 {
00073 obj->setParentID(parentID);
00074 if (use_ref)
00075 obj->setFlag(OBJECT_FLAG_USE_RESOURCE_REF);
00076 obj->setID(INVALID_OBJECT_ID);
00077
00078 ContentManager::getInstance()->addObject(obj);
00079 }
00080
00081 zmm::String FallbackLayout::esc(zmm::String str)
00082 {
00083 return escape(str, VIRTUAL_CONTAINER_ESCAPE, VIRTUAL_CONTAINER_SEPARATOR);
00084 }
00085
00086 void FallbackLayout::addVideo(zmm::Ref<CdsObject> obj, String rootpath)
00087 {
00088 Ref<StringConverter> f2i = StringConverter::f2i();
00089 int id = ContentManager::getInstance()->addContainerChain(_("/Video/All Video"));
00090
00091 if (obj->getID() != INVALID_OBJECT_ID)
00092 {
00093 obj->setRefID(obj->getID());
00094 add(obj, id);
00095 }
00096 else
00097 {
00098 add(obj, id);
00099 obj->setRefID(obj->getID());
00100 }
00101
00102 String dir;
00103
00104 if (string_ok(rootpath))
00105 {
00106 rootpath = rootpath.substring(0, rootpath.rindex(DIR_SEPARATOR));
00107
00108 dir = obj->getLocation().substring(rootpath.length(), obj->getLocation().rindex(DIR_SEPARATOR)-rootpath.length());
00109
00110 if (dir.startsWith(_DIR_SEPARATOR))
00111 dir = dir.substring(1);
00112
00113 dir = f2i->convert(dir);
00114 }
00115 else
00116 dir = esc(f2i->convert(get_last_path(obj->getLocation())));
00117
00118 if (string_ok(dir))
00119 {
00120 id = ContentManager::getInstance()->addContainerChain(_("/Video/Directories/") + dir);
00121 add(obj, id);
00122 }
00123 }
00124
00125 #ifdef HAVE_LIBDVDNAV
00126
00127 Ref<CdsObject> FallbackLayout::prepareChapter(Ref<CdsObject> obj, int title_idx,
00128 int chapter_idx)
00129 {
00130 String chapter_name = _("Chapter ");
00131
00132 obj->getResource(0)->addParameter(DVDHandler::renderKey(DVD_Chapter),
00133 String::from(chapter_idx));
00134
00135 if (chapter_idx < 9)
00136 chapter_name = chapter_name + _("0") + (chapter_idx + 1);
00137 else
00138 chapter_name = chapter_name + (chapter_idx + 1);
00139
00140 obj->setTitle(chapter_name);
00141
00142
00143
00144
00145
00146 return obj;
00147 }
00148
00149 void FallbackLayout::addDVD(Ref<CdsObject> obj)
00150 {
00151 #define DVD_VPATH "/Video/DVD/"
00152
00153 int dot = obj->getTitle().rindex('.');
00154 int pcd_id = obj->getID();
00155 String dvd_name;
00156
00157 if (dot > -1)
00158 dvd_name = obj->getTitle().substring(0, dot);
00159 else
00160 dvd_name = obj->getTitle();
00161
00162 String dvd_container = _(DVD_VPATH) + esc(dvd_name);
00163 Ref<ContentManager> cm = ContentManager::getInstance();
00164
00165 int id = cm->addContainerChain(dvd_container, nil, pcd_id);
00166
00167
00168
00169
00170
00171 if (obj->getID() != INVALID_OBJECT_ID)
00172 {
00173 obj->setRefID(obj->getID());
00174 add(obj, id);
00175 }
00176
00177
00178
00179 else
00180 {
00181 add(obj, id);
00182 obj->setRefID(obj->getID());
00183 }
00184
00185 dvd_container = dvd_container + _("/");
00186
00187 int title_count = obj->getAuxData(DVDHandler::renderKey(DVD_TitleCount)).toInt();
00188
00189 RefCast(obj, CdsItem)->setMimeType(mpeg_mimetype);
00190 obj->getResource(0)->addAttribute(MetadataHandler::getResAttrName(R_PROTOCOLINFO), renderProtocolInfo(RefCast(obj, CdsItem)->getMimeType()));
00191 obj->setClass(_(UPNP_DEFAULT_CLASS_VIDEO_ITEM));
00193 obj->getResource(0)->removeAttribute(MetadataHandler::getResAttrName(R_SIZE));
00194
00195 for (int t = 0; t < title_count; t++)
00196 {
00197 int audio_track_count = obj->getAuxData(DVDHandler::renderKey(DVD_AudioTrackCount, t)).toInt();
00198 obj->getResource(0)->addParameter(DVDHandler::renderKey(DVD_Title),
00199 String::from(t));
00200 for (int a = 0; a < audio_track_count; a++)
00201 {
00202
00203 obj->getResource(0)->addParameter(DVDHandler::renderKey(DVD_AudioStreamID), obj->getAuxData(DVDHandler::renderKey(DVD_AudioTrackStreamID, t, 0, a)));
00204
00205 String tmp = obj->getAuxData(DVDHandler::renderKey(DVD_AudioTrackChannels, t, 0, a));
00206 if (string_ok(tmp))
00207 {
00208 obj->getResource(0)->addAttribute(MetadataHandler::getResAttrName(R_NRAUDIOCHANNELS), tmp);
00209 log_debug("Setting Audio Channels, object %s - num: %s\n",
00210 obj->getLocation().c_str(), tmp.c_str());
00211 }
00212
00213 tmp = obj->getAuxData(DVDHandler::renderKey(DVD_AudioTrackSampleFreq, t, 0, a));
00214 if (string_ok(tmp))
00215 obj->getResource(0)->addAttribute(MetadataHandler::getResAttrName(R_SAMPLEFREQUENCY), tmp);
00216
00217 String title_container = _("Titles/");
00218 String title_name;
00219
00220 if (t < 9)
00221 title_name = _("Title 0") + (t + 1);
00222 else
00223 title_name = _("Title ") + (t + 1);
00224
00225 String format = obj->getAuxData(DVDHandler::renderKey(DVD_AudioTrackFormat, t, 0, a));
00226 String language = obj->getAuxData(DVDHandler::renderKey(DVD_AudioTrackLanguage, t, 0, a));
00227
00228 title_container = title_container + title_name;
00229
00230 title_container = title_container + _(" - Audio Track ") + (a + 1);
00231 if (string_ok(format))
00232 title_container = title_container + _(" - ") + esc(format);
00233
00234 if (string_ok(language))
00235 title_container = title_container + _(" - ") + esc(language);
00236
00237 title_container = dvd_container + title_container;
00238 id = cm->addContainerChain(title_container, nil, pcd_id);
00239 int chapter_count = obj->getAuxData(DVDHandler::renderKey(DVD_ChapterCount, t)).toInt();
00240
00241 for (int c = 0; c < chapter_count; c++)
00242 {
00243 prepareChapter(obj, t, c);
00244 add(obj, id, false);
00245 }
00246
00247 if (string_ok(language))
00248 {
00249 String language_container = _("Languages/");
00250 String chain = dvd_container + language_container +
00251 esc(language) + _("/") + title_name;
00252
00253 chain = chain + _(" - Audio Track ") + (a + 1);
00254
00255 if (string_ok(format))
00256 chain = chain + _(" - ") + esc(format);
00257
00258 id = cm->addContainerChain(chain, nil, pcd_id);
00259
00260 for (int c = 0; c < chapter_count; c++)
00261 {
00262 prepareChapter(obj, t, c);
00263 add(obj, id, false);
00264 }
00265 }
00266
00267 if (string_ok(format))
00268 {
00269 String format_container = _("Audio Formats/");
00270 String chain = dvd_container + format_container + esc(format) +
00271 _("/") + title_name;
00272
00273 chain = chain + _(" - Audio Track ") + (a + 1);
00274
00275 if (string_ok(language))
00276 chain = chain + _(" - ") + esc(language);
00277
00278 id = cm->addContainerChain(chain, nil, pcd_id);
00279 for (int c = 0; c < chapter_count; c++)
00280 {
00281 prepareChapter(obj, t, c);
00282 add(obj, id, false);
00283 }
00284 }
00285 }
00286 }
00287 }
00288 #endif
00289
00290 void FallbackLayout::addImage(Ref<CdsObject> obj, String rootpath)
00291 {
00292 int id;
00293 Ref<StringConverter> f2i = StringConverter::f2i();
00294
00295
00296 id = ContentManager::getInstance()->addContainerChain(_("/Photos/All Photos"));
00297 if (obj->getID() != INVALID_OBJECT_ID)
00298 {
00299 obj->setRefID(obj->getID());
00300 add(obj, id);
00301 }
00302 else
00303 {
00304 add(obj, id);
00305 obj->setRefID(obj->getID());
00306 }
00307
00308 Ref<Dictionary> meta = obj->getMetadata();
00309
00310 String date = meta->get(MetadataHandler::getMetaFieldName(M_DATE));
00311 if (string_ok(date))
00312 {
00313 String year, month;
00314 int m = -1;
00315 int y = date.index('-');
00316 if (y > 0)
00317 {
00318 year = date.substring(0, y);
00319 month = date.substring(y + 1);
00320 m = month.index('-');
00321 if (m > 0)
00322 month = month.substring(0, m);
00323 }
00324
00325 String chain;
00326 if ((y > 0) && (m > 0))
00327 {
00328 chain = _("/Photos/Year/") + esc(year) + "/" + esc(month);
00329 id = ContentManager::getInstance()->addContainerChain(chain);
00330 add(obj, id);
00331 }
00332
00333 chain = _("/Photos/Date/") + esc(date);
00334 id = ContentManager::getInstance()->addContainerChain(chain);
00335 add(obj, id);
00336 }
00337
00338 String dir;
00339
00340 if (string_ok(rootpath))
00341 {
00342 rootpath = rootpath.substring(0, rootpath.rindex(DIR_SEPARATOR));
00343
00344 dir = obj->getLocation().substring(rootpath.length(), obj->getLocation().rindex(DIR_SEPARATOR)-rootpath.length());
00345
00346 if (dir.startsWith(_DIR_SEPARATOR))
00347 dir = dir.substring(1);
00348
00349 dir = f2i->convert(dir);
00350 }
00351 else
00352 dir = esc(f2i->convert(get_last_path(obj->getLocation())));
00353
00354 if (string_ok(dir))
00355 {
00356 id = ContentManager::getInstance()->addContainerChain(_("/Photos/Directories/") + dir);
00357 add(obj, id);
00358 }
00359 }
00360
00361 void FallbackLayout::addAudio(zmm::Ref<CdsObject> obj)
00362 {
00363 String desc;
00364 String chain;
00365 String artist_full;
00366 String album_full;
00367
00368 int id;
00369
00370 Ref<Dictionary> meta = obj->getMetadata();
00371
00372 String title = meta->get(MetadataHandler::getMetaFieldName(M_TITLE));
00373 if (!string_ok(title))
00374 title = obj->getTitle();
00375
00376 String artist = meta->get(MetadataHandler::getMetaFieldName(M_ARTIST));
00377 if (string_ok(artist))
00378 {
00379 artist_full = artist;
00380 desc = artist;
00381 }
00382 else
00383 artist = _("Unknown");
00384
00385 String album = meta->get(MetadataHandler::getMetaFieldName(M_ALBUM));
00386 if (string_ok(album))
00387 {
00388 desc = desc + _(", ") + album;
00389 album_full = album;
00390 }
00391 else
00392 {
00393 album = _("Unknown");
00394 }
00395
00396 if (string_ok(desc))
00397 desc = desc + _(", ");
00398
00399 desc = desc + title;
00400
00401 String date = meta->get(MetadataHandler::getMetaFieldName(M_DATE));
00402 if (string_ok(date))
00403 {
00404 int i = date.index('-');
00405 if (i > 0)
00406 date = date.substring(0, i);
00407
00408 desc = desc + _(", ") + date;
00409 }
00410 else
00411 date = _("Unknown");
00412
00413 String genre = meta->get(MetadataHandler::getMetaFieldName(M_GENRE));
00414 if (string_ok(genre))
00415 desc = desc + ", " + genre;
00416 else
00417 genre = _("Unknown");
00418
00419
00420 String description = meta->get(MetadataHandler::getMetaFieldName(M_DESCRIPTION));
00421 if (!string_ok(description))
00422 {
00423 meta->put(MetadataHandler::getMetaFieldName(M_DESCRIPTION), desc);
00424 obj->setMetadata(meta);
00425 }
00426
00427 id = ContentManager::getInstance()->addContainerChain(_("/Audio/All Audio"));
00428 obj->setTitle(title);
00429
00430
00431
00432
00433
00434 if (obj->getID() != INVALID_OBJECT_ID)
00435 {
00436 obj->setRefID(obj->getID());
00437 add(obj, id);
00438 }
00439
00440
00441
00442 else
00443 {
00444 add(obj, id);
00445 obj->setRefID(obj->getID());
00446 }
00447
00448 artist = esc(artist);
00449
00450 chain = _("/Audio/Artists/") + artist + "/All Songs";
00451
00452 id = ContentManager::getInstance()->addContainerChain(chain);
00453 add(obj, id);
00454
00455 String temp;
00456 if (string_ok(artist_full))
00457 temp = artist_full;
00458
00459 if (string_ok(album_full))
00460 temp = temp + " - " + album_full + " - ";
00461 else
00462 temp = temp + " - ";
00463
00464 album = esc(album);
00465 chain = _("/Audio/Artists/") + artist + _("/") + album;
00466 id = ContentManager::getInstance()->addContainerChain(chain, _(UPNP_DEFAULT_CLASS_MUSIC_ALBUM));
00467 add(obj, id);
00468
00469 chain = _("/Audio/Albums/") + album;
00470 id = ContentManager::getInstance()->addContainerChain(chain, _(UPNP_DEFAULT_CLASS_MUSIC_ALBUM));
00471 add(obj, id);
00472
00473 chain = _("/Audio/Genres/") + esc(genre);
00474 id = ContentManager::getInstance()->addContainerChain(chain, _(UPNP_DEFAULT_CLASS_MUSIC_GENRE));
00475 add(obj, id);
00476
00477 chain = _("/Audio/Year/") + esc(date);
00478 id = ContentManager::getInstance()->addContainerChain(chain);
00479 add(obj, id);
00480
00481 obj->setTitle(temp + title);
00482
00483 id = ContentManager::getInstance()->addContainerChain(_("/Audio/All - full name"));
00484 add(obj, id);
00485
00486 chain = _("/Audio/Artists/") + artist + "/All - full name";
00487 id = ContentManager::getInstance()->addContainerChain(chain);
00488 add(obj, id);
00489
00490
00491 }
00492 #ifdef YOUTUBE
00493 void FallbackLayout::addYouTube(zmm::Ref<CdsObject> obj)
00494 {
00495 #define YT_VPATH "/Online Services/YouTube"
00496 String chain;
00497 String temp;
00498 int id;
00499 bool ref_set = false;
00500
00501 if (obj->getID() != INVALID_OBJECT_ID)
00502 {
00503 obj->setRefID(obj->getID());
00504 ref_set = true;
00505 }
00506
00507 temp = obj->getAuxData(_(YOUTUBE_AUXDATA_AVG_RATING));
00508 if (string_ok(temp))
00509 {
00510 int rating = (int)temp.toDouble();
00511 if (rating > 3)
00512 {
00513 chain = _(YT_VPATH "/Rating/") + esc(String::from(rating));
00514 id = ContentManager::getInstance()->addContainerChain(chain);
00515 add(obj, id, ref_set);
00516 if (!ref_set)
00517 {
00518 obj->setRefID(obj->getID());
00519 ref_set = true;
00520 }
00521 }
00522 }
00523
00524 temp = obj->getAuxData(_(YOUTUBE_AUXDATA_REQUEST));
00525 if (string_ok(temp))
00526 {
00527 yt_requests_t req = (yt_requests_t)temp.toInt();
00528 temp = YouTubeService::getRequestName(req);
00529
00530 String subName = obj->getAuxData(_(YOUTUBE_AUXDATA_SUBREQUEST_NAME));
00531 String feedName = obj->getAuxData(_(YOUTUBE_AUXDATA_FEED));
00532 String region = obj->getAuxData(_(YOUTUBE_AUXDATA_REGION));
00533
00534 chain = _(YT_VPATH) + '/' + esc(temp);
00535
00536 if (string_ok(subName))
00537 chain = chain + '/' + esc(subName);
00538
00539 if (string_ok(feedName))
00540 chain = chain + '/' + esc(feedName);
00541
00542 if (string_ok(region))
00543 { yt_regions_t reg = (yt_regions_t)region.toInt();
00544 if (reg != YT_region_none)
00545 {
00546 region = YouTubeService::getRegionName(reg);
00547 if (string_ok(region));
00548 chain = chain + '/' + esc(region);
00549 }
00550 }
00551
00552 id = ContentManager::getInstance()->addContainerChain(chain);
00553 add(obj, id, ref_set);
00554 }
00555 }
00556 #endif
00557
00558 #ifdef SOPCAST
00559 void FallbackLayout::addSopCast(zmm::Ref<CdsObject> obj)
00560 {
00561 #define SP_VPATH "/Online Services/SopCast"
00562 String chain;
00563 String temp;
00564 int id;
00565 bool ref_set = false;
00566
00567 if (obj->getID() != INVALID_OBJECT_ID)
00568 {
00569 obj->setRefID(obj->getID());
00570 ref_set = true;
00571 }
00572
00573 chain = _(SP_VPATH "/" "All Channels");
00574 id = ContentManager::getInstance()->addContainerChain(chain);
00575 add(obj, id, ref_set);
00576 if (!ref_set)
00577 {
00578 obj->setRefID(obj->getID());
00579 ref_set = true;
00580 }
00581
00582 temp = obj->getAuxData(_(SOPCAST_AUXDATA_GROUP));
00583 if (string_ok(temp))
00584 {
00585 chain = _(SP_VPATH "/" "Groups" "/") + esc(temp);
00586 id = ContentManager::getInstance()->addContainerChain(chain);
00587 add(obj, id, ref_set);
00588 }
00589 }
00590 #endif
00591
00592 #ifdef WEBORAMA
00593 void FallbackLayout::addWeborama(zmm::Ref<CdsObject> obj)
00594 {
00595 #define WB_VPATH "/Online Services/Weborama"
00596 String chain;
00597 String temp;
00598 int id;
00599 bool ref_set = false;
00600
00601 if (obj->getID() != INVALID_OBJECT_ID)
00602 {
00603 obj->setRefID(obj->getID());
00604 ref_set = true;
00605 }
00606
00607 temp = obj->getAuxData(_(WEBORAMA_AUXDATA_REQUEST_NAME));
00608 if (!string_ok(temp))
00609 {
00610 log_warning("Skipping Weborama item %s: missing playlist name\n",
00611 obj->getTitle().c_str());
00612 return;
00613 }
00614
00615 chain = _(WB_VPATH "/") + esc(temp);
00616 id = ContentManager::getInstance()->addContainerChain(chain,
00617 _(UPNP_DEFAULT_CLASS_PLAYLIST_CONTAINER));
00618 add(obj, id, ref_set);
00619 }
00620 #endif
00621
00622 #ifdef ATRAILERS
00623 void FallbackLayout::addATrailers(zmm::Ref<CdsObject> obj)
00624 {
00625 #define AT_VPATH "/Online Services/Apple Trailers"
00626 String chain;
00627 String temp;
00628
00629 int id = ContentManager::getInstance()->addContainerChain(_(AT_VPATH
00630 "/All Trailers"));
00631
00632 if (obj->getID() != INVALID_OBJECT_ID)
00633 {
00634 obj->setRefID(obj->getID());
00635 add(obj, id);
00636 }
00637 else
00638 {
00639 add(obj, id);
00640 obj->setRefID(obj->getID());
00641 }
00642
00643 Ref<Dictionary> meta = obj->getMetadata();
00644
00645 temp = meta->get(MetadataHandler::getMetaFieldName(M_GENRE));
00646 if (string_ok(temp))
00647 {
00648 Ref<StringTokenizer> st(new StringTokenizer(temp));
00649 String genre;
00650 String next;
00651 do
00652 {
00653 if (!string_ok(genre))
00654 genre = st->nextToken(_(","));
00655 next = st->nextToken(_(","));
00656
00657 genre = trim_string(genre);
00658
00659 if (!string_ok(genre))
00660 break;
00661
00662 id = ContentManager::getInstance()->addContainerChain(_(AT_VPATH
00663 "/Genres/") + esc(genre));
00664 add(obj, id);
00665
00666 if (string_ok(next))
00667 genre = next;
00668 else
00669 genre = nil;
00670
00671 } while (genre != nil);
00672 }
00673
00674 temp = meta->get(MetadataHandler::getMetaFieldName(M_DATE));
00675 if (string_ok(temp) && temp.length() >= 7)
00676 {
00677 id = ContentManager::getInstance()->addContainerChain(_(AT_VPATH
00678 "/Release Date/") + esc(temp.substring(0, 7)));
00679 add(obj, id);
00680 }
00681
00682 temp = obj->getAuxData(_(ATRAILERS_AUXDATA_POST_DATE));
00683 if (string_ok(temp) && temp.length() >= 7)
00684 {
00685 id = ContentManager::getInstance()->addContainerChain(_(AT_VPATH
00686 "/Post Date/") + esc(temp.substring(0, 7)));
00687 add(obj, id);
00688 }
00689 }
00690 #endif
00691
00692 FallbackLayout::FallbackLayout() : Layout()
00693 {
00694 #ifdef ENABLE_PROFILING
00695 PROF_INIT_GLOBAL(layout_profiling, "fallback layout");
00696 #endif
00697
00698 #ifdef HAVE_LIBDVDNAV
00699 Ref<Dictionary> mappings = ConfigManager::getInstance()->getDictionaryOption(CFG_IMPORT_MAPPINGS_MIMETYPE_TO_CONTENTTYPE_LIST);
00700 mpeg_mimetype = mappings->get(_(CONTENT_TYPE_MPEG));
00701 if (!string_ok(mpeg_mimetype))
00702 mpeg_mimetype = _("video/mpeg");
00703 #endif
00704 }
00705
00706 void FallbackLayout::processCdsObject(zmm::Ref<CdsObject> obj, String rootpath)
00707 {
00708 log_debug("Process CDS Object: %s\n", obj->getTitle().c_str());
00709 #ifdef ENABLE_PROFILING
00710 PROF_START(&layout_profiling);
00711 #endif
00712 Ref<CdsObject> clone = CdsObject::createObject(obj->getObjectType());
00713 obj->copyTo(clone);
00714 clone->setVirtual(1);
00715
00716 #ifdef ONLINE_SERVICES
00717 if (clone->getFlag(OBJECT_FLAG_ONLINE_SERVICE))
00718 {
00719 service_type_t service = (service_type_t)(clone->getAuxData(_(ONLINE_SERVICE_AUX_ID)).toInt());
00720
00721 switch (service)
00722 {
00723 #ifdef YOUTUBE
00724 case OS_YouTube:
00725 addYouTube(clone);
00726 break;
00727 #endif
00728 #ifdef SOPCAST
00729 case OS_SopCast:
00730 addSopCast(clone);
00731 break;
00732 #endif
00733 #ifdef WEBORAMA
00734 case OS_Weborama:
00735 addWeborama(clone);
00736 break;
00737 #endif
00738 #ifdef ATRAILERS
00739 case OS_ATrailers:
00740 addATrailers(clone);
00741 break;
00742 #endif
00743 case OS_Max:
00744 default:
00745 log_warning("No handler for service type\n");
00746 break;
00747 }
00748 }
00749 else
00750 {
00751 #endif
00752
00753 String mimetype = RefCast(obj, CdsItem)->getMimeType();
00754 Ref<Dictionary> mappings =
00755 ConfigManager::getInstance()->getDictionaryOption(
00756 CFG_IMPORT_MAPPINGS_MIMETYPE_TO_CONTENTTYPE_LIST);
00757 String content_type = mappings->get(mimetype);
00758
00759 if (mimetype.startsWith(_("video")))
00760 addVideo(clone, rootpath);
00761 else if (mimetype.startsWith(_("image")))
00762 addImage(clone, rootpath);
00763 else if ((mimetype.startsWith(_("audio")) &&
00764 (content_type != CONTENT_TYPE_PLAYLIST)))
00765 addAudio(clone);
00766 else if (content_type == CONTENT_TYPE_OGG)
00767 {
00768 if (obj->getFlag(OBJECT_FLAG_OGG_THEORA))
00769 addVideo(clone, rootpath);
00770 else
00771 addAudio(clone);
00772 }
00773 #ifdef HAVE_LIBDVDNAV
00774 else if (content_type == CONTENT_TYPE_DVD)
00775 addDVD(clone);
00776 #endif
00777
00778 #ifdef ONLINE_SERVICES
00779 }
00780 #endif
00781 #ifdef ENABLE_PROFILING
00782 PROF_END(&layout_profiling);
00783 #endif
00784 }
00785
00786 #ifdef ENABLE_PROFILING
00787 FallbackLayout::~FallbackLayout()
00788 {
00789 PROF_PRINT(&layout_profiling);
00790 }
00791 #endif