[video] Fix the refresh of movies with additional versions or extras
[xbmc.git] / xbmc / media / MediaType.h
blob2fe00acef45a20d59f29746109e3876260bcc351
1 /*
2 * Copyright (C) 2013-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
9 #pragma once
11 #include <map>
12 #include <string>
14 using MediaType = std::string;
16 #define MediaTypeNone ""
17 #define MediaTypeMusic "music"
18 #define MediaTypeArtist "artist"
19 #define MediaTypeAlbum "album"
20 #define MediaTypeSong "song"
21 #define MediaTypeVideo "video"
22 #define MediaTypeVideoCollection "set"
23 #define MediaTypeMusicVideo "musicvideo"
24 #define MediaTypeMovie "movie"
25 #define MediaTypeTvShow "tvshow"
26 #define MediaTypeSeason "season"
27 #define MediaTypeEpisode "episode"
28 #define MediaTypeVideoVersion "videoversion"
30 constexpr const char* MediaTypeVideoCollections = "sets";
31 constexpr const char* MediaTypeMusicVideos = "musicvideos";
32 constexpr const char* MediaTypeMovies = "movies";
33 constexpr const char* MediaTypeTvShows = "tvshows";
34 constexpr const char* MediaTypeSeasons = "seasons";
35 constexpr const char* MediaTypeEpisodes = "episodes";
37 class CMediaTypes
39 public:
40 static bool IsValidMediaType(const MediaType &mediaType);
41 static bool IsMediaType(const std::string &strMediaType, const MediaType &mediaType);
42 static MediaType FromString(const std::string &strMediaType);
43 static MediaType ToPlural(const MediaType &mediaType);
45 static bool IsContainer(const MediaType &mediaType);
47 static std::string GetLocalization(const MediaType &mediaType);
48 static std::string GetPluralLocalization(const MediaType &mediaType);
49 static std::string GetCapitalLocalization(const MediaType &mediaType);
50 static std::string GetCapitalPluralLocalization(const MediaType &mediaType);
52 struct MediaTypeInfo
54 MediaTypeInfo(const MediaType &mediaType, const std::string &plural, bool container,
55 int localizationSingular, int localizationPlural,
56 int localizationSingularCapital, int localizationPluralCapital)
57 : mediaType(mediaType),
58 plural(plural),
59 container(container),
60 localizationSingular(localizationSingular),
61 localizationPlural(localizationPlural),
62 localizationSingularCapital(localizationSingularCapital),
63 localizationPluralCapital(localizationPluralCapital)
64 { }
66 MediaType mediaType;
67 std::string plural;
68 bool container;
69 int localizationSingular;
70 int localizationPlural;
71 int localizationSingularCapital;
72 int localizationPluralCapital;
75 private:
76 static std::map<std::string, MediaTypeInfo>::const_iterator findMediaType(const std::string &mediaType);
78 static std::map<std::string, MediaTypeInfo> m_mediaTypes;