// connection.Query("delete from PlexContent where type = @type", new { type = 0 });
// return new List<PlexContent>();
//});
foreach(varminmovies)
{
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=>
{
{
connection.Open();
connection.Open();
connection.Query("delete from PlexContent where type = @type",new{type=0});
varmedia=connection.QueryFirstOrDefault<PlexContent>("select * from PlexContent where ProviderId = @ProviderId and type = @type",new{m.ProviderId,type=0});
returnnewList<PlexContent>();
connection.Dispose();
returnmedia;
});
});
foreach(varminmovies)
if(item==null)
{
{
// Doesn't exist, insert it
PlexContent.Insert(newPlexContent
PlexContent.Insert(newPlexContent
{
{
ProviderId=m.ProviderId,
ProviderId=m.ProviderId,
@ -253,15 +271,35 @@ namespace Ombi.Services.Jobs
Url=m.Url
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.Query("delete from PlexContent where type = @type", new { type = 1 });
// return new List<PlexContent>();
//});
foreach(vartintv)
{
if(string.IsNullOrEmpty(t.ProviderId))
{
Log.Error("Provider Id on tv {0} is null",t.Title);
continue;
}
// Check if it exists
varitem=PlexContent.Custom(connection=>
{
{
connection.Open();
connection.Open();
connection.Query("delete from PlexContent where type = @type",new{type=1});
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 });
// return new List<PlexContent>();
//});
foreach(varainalbums)
{
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=>
{
{
connection.Open();
connection.Open();
connection.Query("delete from PlexContent where type = @type",new{type=2});
varmedia=connection.QueryFirstOrDefault<PlexContent>("select * from PlexContent where ProviderId = @ProviderId and type = @type",new{a.ProviderId,type=2});