added new studio image provider

This commit is contained in:
Luke Pulverenti 2013-12-29 00:32:03 -05:00
parent 052e632a97
commit feff0c711f
9 changed files with 643 additions and 18 deletions

View File

@ -44,12 +44,6 @@ namespace MediaBrowser.Controller.LiveTv
/// </summary> /// </summary>
public DateTime EndDate { get; set; } public DateTime EndDate { get; set; }
/// <summary>
/// Gets or sets the aspect ratio.
/// </summary>
/// <value>The aspect ratio.</value>
public string AspectRatio { get; set; }
/// <summary> /// <summary>
/// Genre of the program. /// Genre of the program.
/// </summary> /// </summary>

View File

@ -48,12 +48,6 @@ namespace MediaBrowser.Model.LiveTv
/// <value>The community rating.</value> /// <value>The community rating.</value>
public float? CommunityRating { get; set; } public float? CommunityRating { get; set; }
/// <summary>
/// Gets or sets the aspect ratio.
/// </summary>
/// <value>The aspect ratio.</value>
public string AspectRatio { get; set; }
/// <summary> /// <summary>
/// Gets or sets the official rating. /// Gets or sets the official rating.
/// </summary> /// </summary>

View File

@ -120,6 +120,7 @@
<Compile Include="Savers\SeasonXmlSaver.cs" /> <Compile Include="Savers\SeasonXmlSaver.cs" />
<Compile Include="Savers\SeriesXmlSaver.cs" /> <Compile Include="Savers\SeriesXmlSaver.cs" />
<Compile Include="Savers\XmlSaverHelpers.cs" /> <Compile Include="Savers\XmlSaverHelpers.cs" />
<Compile Include="Studios\StudioImageProvider.cs" />
<Compile Include="TV\EpisodeImageFromMediaLocationProvider.cs" /> <Compile Include="TV\EpisodeImageFromMediaLocationProvider.cs" />
<Compile Include="TV\EpisodeIndexNumberProvider.cs" /> <Compile Include="TV\EpisodeIndexNumberProvider.cs" />
<Compile Include="TV\EpisodeProviderFromXml.cs" /> <Compile Include="TV\EpisodeProviderFromXml.cs" />
@ -165,6 +166,9 @@
<ItemGroup> <ItemGroup>
<None Include="packages.config" /> <None Include="packages.config" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Studios\images.txt" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition=" '$(ConfigurationName)' != 'Release Mono' " /> <Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition=" '$(ConfigurationName)' != 'Release Mono' " />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- To modify your build process, add your task inside one of the targets below and uncomment it.

View File

@ -1,7 +1,7 @@
using MediaBrowser.Common.IO; using MediaBrowser.Common.IO;
using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.Movies; using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Controller.Persistence; using MediaBrowser.Controller.Persistence;
using MediaBrowser.Controller.Providers; using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.Entities; using MediaBrowser.Model.Entities;
@ -48,7 +48,8 @@ namespace MediaBrowser.Providers.Movies
return !trailer.IsLocalTrailer; return !trailer.IsLocalTrailer;
} }
return item is Movie || item is MusicVideo || item is AdultVideo; // Check parent for null to avoid running this against things like video backdrops
return item is Video && !(item is Episode) && item.Parent != null;
} }
/// <summary> /// <summary>

View File

@ -1,10 +1,9 @@
using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.Movies; using MediaBrowser.Controller.Entities.Movies;
using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Persistence; using MediaBrowser.Controller.Persistence;
using MediaBrowser.Providers.Movies;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization; using System.Globalization;
using System.IO; using System.IO;
@ -50,7 +49,8 @@ namespace MediaBrowser.Providers.Savers
return !trailer.IsLocalTrailer; return !trailer.IsLocalTrailer;
} }
return item is Movie || item is MusicVideo || item is AdultVideo; // Check parent for null to avoid running this against things like video backdrops
return item is Video && !(item is Episode) && item.Parent != null;
} }
return false; return false;

View File

@ -0,0 +1,138 @@
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Logging;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
namespace MediaBrowser.Providers.Studios
{
public class StudioImageProvider : BaseMetadataProvider
{
private readonly IProviderManager _providerManager;
private readonly SemaphoreSlim _resourcePool = new SemaphoreSlim(5, 5);
public StudioImageProvider(ILogManager logManager, IServerConfigurationManager configurationManager, IProviderManager providerManager)
: base(logManager, configurationManager)
{
_providerManager = providerManager;
}
public override bool Supports(BaseItem item)
{
return item is Studio;
}
public override bool RequiresInternet
{
get
{
return true;
}
}
public override ItemUpdateType ItemUpdateType
{
get
{
return ItemUpdateType.ImageUpdate;
}
}
protected override bool NeedsRefreshInternal(BaseItem item, BaseProviderInfo providerInfo)
{
if (!string.IsNullOrEmpty(item.PrimaryImagePath))
{
return false;
}
return base.NeedsRefreshInternal(item, providerInfo);
}
protected override bool RefreshOnVersionChange
{
get
{
return true;
}
}
protected override string ProviderVersion
{
get
{
return "1";
}
}
public override async Task<bool> FetchAsync(BaseItem item, bool force, BaseProviderInfo providerInfo, CancellationToken cancellationToken)
{
if (string.IsNullOrEmpty(item.PrimaryImagePath))
{
var list = GetAvailableImages();
var match = FindMatch(item, list);
if (!string.IsNullOrEmpty(match))
{
var url = GetUrl(match);
await _providerManager.SaveImage(item, url, _resourcePool, ImageType.Primary, null, cancellationToken).ConfigureAwait(false);
}
}
SetLastRefreshed(item, DateTime.UtcNow, providerInfo);
return true;
}
private string FindMatch(BaseItem item, IEnumerable<string> images)
{
var name = GetComparableName(item.Name);
return images.FirstOrDefault(i => string.Equals(name, GetComparableName(i), StringComparison.OrdinalIgnoreCase));
}
private string GetComparableName(string name)
{
return name.Replace(" ", string.Empty).Replace(".", string.Empty).Replace("&", string.Empty).Replace("!", string.Empty);
}
private string GetUrl(string image)
{
return string.Format("https://raw.github.com/MediaBrowser/MediaBrowser.Resources/master/images/studios/{0}/folder.jpg", image);
}
private IEnumerable<string> GetAvailableImages()
{
var path = GetType().Namespace + ".images.txt";
using (var stream = GetType().Assembly.GetManifestResourceStream(path))
{
using (var reader = new StreamReader(stream))
{
var lines = new List<string>();
while (!reader.EndOfStream)
{
var text = reader.ReadLine();
lines.Add(text);
}
return lines;
}
}
}
public override MetadataProviderPriority Priority
{
get { return MetadataProviderPriority.Third; }
}
}
}

View File

@ -0,0 +1,490 @@
15 Gigs
19 Entertainment
20th Television
321 Productions
4K Media
4Kids Entertainment
A La Carte Communications
A&E
Aardman
ABC
ABC Family
ABC News
ABC Studios
Above Average
Acacia Fitness
Action Television
Advertising Age
All Channel Films
All3Media
Alli
Alliance Entertainment
Alloy
AllWarriorNetwork
American Pop Classics
Ananey
Anchor Bay Entertainment
Anderson Digital
Animal Planet
Animation Domination High-Def
Anime Network
Aniplex
Anyone But Me, LLC
Artists Den Entertainment
Asian Crush
Atlantic Records
Attention Span
Austin City Limits Music Festival
Australian Broadcasting Corporation
Australian Food TV
Avalon UK
Azteca America
Bandai
Base 79
BBC Worldwide
Beliefnet
Believe
BET
Beta Film
Big Air Studios
BIGFlix
bio
Blame Society
Blastro Networks
Bloody Disgusting Selects
Bloomberg
Bonnier TV Group
Border Entertainment
Brain Farm
Brainstorm Media
Brave New Films
Bravo
Broadway Video
Brushfire Records
Butaca
BVTV
C3 Entertainment
Canal 13 de Chile
Candlelight Media
Candor TV
Caracol Television
Carsey Werner
CBS
CelebTV
Charlie Rose
Cheflive
CHIC.TV
Chiller
China Lion
Cine Real
Cinedigm
CINELAN
Cinema Guild
Cinema Libre Studio
Cinema Purgatorio
CineSport
Cirque du Soleil
Citizens United Productions No. 3
CJ Entertainment
Classic Media
Clinton Global Initiative
Cloo
ClubWPT
CNBC
CODA BOOKS
CollegeHumor
Comedy Central
Comedy Time
Conde Nast Digital
Constantin Film
Content and Co
Content Family
Content Media Corporation
Contentino
Cooking Channel
Crackle
Crime & Investigation Network
Criterion Collection
CRM
Cuppa Coffee
Dark Sky Films
Dave Matthews Band
Davis Panzer
Debutante Inc
Digital Artists
Digital Rights Group
Digital Studios
Discovery Channel
Distribber
Diva
DIY Network
DocComTV
DramaFever
Duopoly
E! Entertainment
EA Sports
Eagle Media
Eagle Rock
Echo Bridge Entertainment
Echo Pictures
EchoBoom Sports
Edmunds
ElecPlay
Electric Entertainment
Electric Sky
ELLE
EMI
Enchanted Tales
Endemol
Entertainment Rights
eOne Entertainment Distribution
Epicurious.com
Eqal
Esquire Network
Estrella TV
Everyday Edisons
Evil Global
Exclusive Media
ExerciseTV
Fanclub
Fangoria
FEARnet
Fever Dreams
Fight TV
Film Ideas on Demand
Film Movement
Film Sales Company
FilmBuff
Finley-Holiday Films
First Look Studios
First Run Features
Focus Features
Food Network
FORA.tv
Ford
FOX
Fox Business
Fox College Sports
Fox Movie Channel
Fox News
Fox Reality
Fox Sports
Fox Sports Net
Fox Television Classics
Frantic Films
FremantleMedia
FUEL TV
FUNimation
FX
FXM
FXX
G4
Gaiam
Galavision
GameTrailers
Generate
George Dickel
Giant Ape Media
Glamour Films
GoDigital
Golf TV
Gong
Gorilla Pictures
Gravitas
Gravitas Horror
GreenLight Media
GT Media
H2
Handmade TV
Hat Trick
HD Films, Inc
Health Science Channel
HealthiNation
HereTV
HGTV
Historic Films
History
History en Español
HitFix
Hollywood Pictures
How it Works
Howcast
Howdini
Hudsun Media
Hulu Original Series
Hype
Iconix
iCue.com
IFC
IFC Films
IGN
Image Entertainment
Imagina US
Independent Comedy Network
Independent International Pictures Corp
Indie Crush
IndieFlix
itsallinyourhands.tv
ITV
Janson Media
Jim Henson Family TV
K2
KCET
Kidz Bop
Kino Lorber
KinoNation
Klown
Koan
L Studio
Lagardere
Laguna Productions
Latin Crush
Legend Fighting Championship
Legend Films
Lifetime
Link TV
Lionsgate
Liquid Comics
Litton Entertainment
LMN
Local Food Sustainable Network
Logo
lolflix
Long Way Round
Look
Lou Reda Productions
Lucha Libre USA
LXTV
MAN
Manga Entertainment
Manolin Studios
Mar Vista
Martha Stewart Living
Marvel
Maverick Entertainment
Maya
MBC America
Media Blasters
Mentorn
MGM
MHz Networks
Midnight Pulp
Military History
Millennium Media Services
Modelinia
Mojo
MoMedia
Monterey Media
Moonscoop
Moshcam
Movieola
Movies by OHM
Moving Art
MPI
MSNBC
MTV
MulticomTV
MVD Entertainment Group
My Vortexx
My Yoga
MyNetworkTV
NASA
Nat Geo Wild
National Geographic Channel
NBC
NBC News
NBC Sports
NBC Universal
NBCU TV
NCircle
New Renaissance
NHL
Nickelodeon
NickMom
Nikki Sixx
Nirvana Films
NIS America
Novel Ruby Productions
NowThisNews
nuvoTV
O2 Media
OhmTV
Oops Doughnuts
Ora TV
Orange Lounge
ORF Universum
Oscilloscope Laboratories
Oxygen
Paley Media
Panna
Paranormal TV
Passion River
PBS Kids
Phase 4 Films
Players Network
Plum TV
PopSugar TV
Power Rangers
PPI Releasing
PRO
Pure Adrenaline
Pure History
Pure Nature
Pure Science
Questar
Quintus Media
Quiver
Rajshri Media
Raphael Saadiq
Razor & Tie
RCTV
Real Magic TV
Red Bull
Red Hour Digital
ReelAfrican
ReelzChannel
Revolver
Rick Steves' Network
RiffTrax
Right Network
Riverhorse
Roadside Attractions
Ron Hazelton Productions
RooftopComedy
Rovio
RSA
RT
RTE
S and S Entertainment
Saavn
Sachs Judah
Salient Media
Satelight
Saturday Morning TV
SBS
SBS Australia
Scholastic
Science Channel
Scott Entertainment
Screen Media
Sesame Street
Shaftesbury
Shemaroo
Shochiku
Shout! Factory
Showtime
Shree International
Sky Studios
SnagFilms
SOFA
SOMA
Sonar Entertainment
Sony Pictures Television
SoPeachi
Source Interlink Media
SpaceRip
SPEED
Speed Racer Enterprises
Spike
Stand Up To Cancer
Starz
Strand Releasing
Strike.TV
Sundance Channel
SunWorld Pictures
Sweet Irony
Syfy
Syndicado
Synergetic
Talking Baseball with Ed Randall
Tantao Entertainment
TasteTV
Telepictures
TenduTV
The Cannell Studios
The CW
The Democratic National Convention
The Denis Leary Podcasts
The Global Film Initiative
The Jim Henson Company
The Kitchen Diva
The LXD
The Military Network
The Morning After
The National Film Board of Canada
The New York Times
The Onion
The OnLine Network
The Orchard
The Rebound
The Situation Workout
The Sundance Institute
The Three Stooges
The Weinstein Company
The White House
The Wine Library
The Zalman King Company
This Week In Studios
Thunderbird
Tiny Island Productions
TLA Releasing
TLC
TMS Entertainment
Toei Animation
Tokyopop
Total College Sports
Total Content Digital
Touchstone Pictures
Tr3s
Transworld
Travel Channel
Troma
TV Globo
TV Land
TVF International
TVG Interactive Horseracing
TVGN
Twentieth Century Fox
Uncork'd Entertainment
UniMas
Universal Pictures
Universal Sports
Universal Television
Univision
unwrapped.tv
USA
uStudio
Vanguard Cinema
Venevision
Venus
VH1
Vibrant Media
Videofashion
viewster
ViKi
Virgil Films
Vision Films
Vivendi Entertainment
VIZ Media
Vogue.TV
Wall Street Journal
Warner Bros. Records
WatchMojo.com
Water.org
WCG
WE tv
Web Therapy
Well Go
WEP
Westchester Films
Wolfe Video
WWE
Yan Can Cook
Young Hollywood
YourTango
ZDF Enterprises
ZED
Zeitgeist Films
Zodiak Kids
Zodiak Rights
ZoomTV

View File

@ -106,6 +106,11 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies
return FindMovie<AdultVideo>(args.Path, args.FileSystemChildren); return FindMovie<AdultVideo>(args.Path, args.FileSystemChildren);
} }
if (string.Equals(collectionType, CollectionType.HomeVideos, StringComparison.OrdinalIgnoreCase))
{
return FindMovie<Video>(args.Path, args.FileSystemChildren);
}
if (string.IsNullOrEmpty(collectionType) || if (string.IsNullOrEmpty(collectionType) ||
string.Equals(collectionType, CollectionType.Movies, StringComparison.OrdinalIgnoreCase) || string.Equals(collectionType, CollectionType.Movies, StringComparison.OrdinalIgnoreCase) ||
string.Equals(collectionType, CollectionType.BoxSets, StringComparison.OrdinalIgnoreCase)) string.Equals(collectionType, CollectionType.BoxSets, StringComparison.OrdinalIgnoreCase))

View File

@ -301,7 +301,6 @@ namespace MediaBrowser.Server.Implementations.LiveTv
OriginalAirDate = program.OriginalAirDate, OriginalAirDate = program.OriginalAirDate,
Audio = program.Audio, Audio = program.Audio,
CommunityRating = GetClientCommunityRating(program.CommunityRating), CommunityRating = GetClientCommunityRating(program.CommunityRating),
AspectRatio = program.AspectRatio,
IsRepeat = program.IsRepeat, IsRepeat = program.IsRepeat,
EpisodeTitle = program.EpisodeTitle, EpisodeTitle = program.EpisodeTitle,
ChannelName = channelName, ChannelName = channelName,