connection.Query("delete from PlexContent where type = @type", new { type = 0 });
// connection.Query("delete from PlexContent where type = @type", new { type = 0 });
return new List<PlexContent>();
// return new List<PlexContent>();
});
//});
foreach(varminmovies)
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,
connection.Open();
ReleaseYear=m.ReleaseYear??string.Empty,
varmedia=connection.QueryFirstOrDefault<PlexContent>("select * from PlexContent where ProviderId = @ProviderId and type = @type",new{m.ProviderId,type=0});
Title=m.Title,
connection.Dispose();
Type=Store.Models.Plex.PlexMediaType.Movie,
returnmedia;
Url=m.Url
});
});
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);
vartv=GetPlexTvShows(results);
// Time to destroy the plex tv from the DB
//// Time to destroy the plex tv from the DB
PlexContent.Custom(connection=>
//PlexContent.Custom(connection =>
{
//{
connection.Open();
// connection.Open();
connection.Query("delete from PlexContent where type = @type",new{type=1});
// connection.Query("delete from PlexContent where type = @type", new { type = 1 });
returnnewList<PlexContent>();
// return new List<PlexContent>();
});
//});
foreach(vartintv)
foreach(vartintv)
{
{
PlexContent.Insert(newPlexContent
if(string.IsNullOrEmpty(t.ProviderId))
{
{
ProviderId=t.ProviderId,
Log.Error("Provider Id on tv {0} is null",t.Title);
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});
// connection.Query("delete from PlexContent where type = @type", new { type = 2 });
returnnewList<PlexContent>();
// return new List<PlexContent>();
});
//});
foreach(varainalbums)
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,
connection.Open();
ReleaseYear=a.ReleaseYear??string.Empty,
varmedia=connection.QueryFirstOrDefault<PlexContent>("select * from PlexContent where ProviderId = @ProviderId and type = @type",new{a.ProviderId,type=2});