connection.Query("delete from PlexContent where type = @type", new { type = 0 });
return new List<PlexContent>();
});
//// Time to destroy the plex movies from the DB
//PlexContent.Custom(connection =>
//{
// connection.Open();
// connection.Query("delete from PlexContent where type = @type", new { type = 0 });
// return new List<PlexContent>();
//});
foreach(varminmovies)
{
PlexContent.Insert(newPlexContent
if(string.IsNullOrEmpty(m.ProviderId))
{
Log.Error("Provider Id on movie {0} is null",m.Title);
continue;
}
// Check if it exists
varitem=PlexContent.Custom(connection=>
{
ProviderId=m.ProviderId,
ReleaseYear=m.ReleaseYear??string.Empty,
Title=m.Title,
Type=Store.Models.Plex.PlexMediaType.Movie,
Url=m.Url
connection.Open();
varmedia=connection.QueryFirstOrDefault<PlexContent>("select * from PlexContent where ProviderId = @ProviderId and type = @type",new{m.ProviderId,type=0});
connection.Dispose();
returnmedia;
});
if(item==null)
{
// Doesn't exist, insert it
PlexContent.Insert(newPlexContent
{
ProviderId=m.ProviderId,
ReleaseYear=m.ReleaseYear??string.Empty,
Title=m.Title,
Type=Store.Models.Plex.PlexMediaType.Movie,
Url=m.Url
});
}
}
vartv=GetPlexTvShows(results);
// Time to destroy the plex tv from the DB
PlexContent.Custom(connection=>
{
connection.Open();
connection.Query("delete from PlexContent where type = @type",new{type=1});
returnnewList<PlexContent>();
});
//// Time to destroy the plex tv from the DB
//PlexContent.Custom(connection =>
//{
// connection.Open();
// connection.Query("delete from PlexContent where type = @type", new { type = 1 });
Log.Error("Provider Id on tv {0} is null",t.Title);
continue;
}
// Check if it exists
varitem=PlexContent.Custom(connection=>
{
connection.Open();
varmedia=connection.QueryFirstOrDefault<PlexContent>("select * from PlexContent where ProviderId = @ProviderId and type = @type",new{t.ProviderId,type=1});
connection.Query("delete from PlexContent where type = @type",new{type=2});
returnnewList<PlexContent>();
});
//// Time to destroy the plex movies from the DB
//PlexContent.Custom(connection =>
//{
// connection.Open();
// connection.Query("delete from PlexContent where type = @type", new { type = 2 });
// return new List<PlexContent>();
//});
foreach(varainalbums)
{
PlexContent.Insert(newPlexContent
if(string.IsNullOrEmpty(a.ProviderId))
{
Log.Error("Provider Id on album {0} is null",a.Title);
continue;
}
// Check if it exists
varitem=PlexContent.Custom(connection=>
{
ProviderId=a.ProviderId,
ReleaseYear=a.ReleaseYear??string.Empty,
Title=a.Title,
Type=Store.Models.Plex.PlexMediaType.Artist,
Url=a.Url
connection.Open();
varmedia=connection.QueryFirstOrDefault<PlexContent>("select * from PlexContent where ProviderId = @ProviderId and type = @type",new{a.ProviderId,type=2});