Skip to content

Commit

Permalink
Merge pull request #1548 from MediaBrowser/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
LukePulverenti committed Mar 14, 2016
2 parents 0052e14 + b9a4186 commit 72207f9
Show file tree
Hide file tree
Showing 35 changed files with 376 additions and 226 deletions.
1 change: 1 addition & 0 deletions MediaBrowser.Api/StartupWizardService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ public void Post(ReportStartupWizardComplete request)
_config.Configuration.EnableLocalizedGuids = true;
_config.Configuration.EnableCustomPathSubFolders = true;
_config.Configuration.EnableDateLastRefresh = true;
_config.Configuration.EnableStandaloneMusicKeys = true;
_config.SaveConfiguration();
}

Expand Down
25 changes: 25 additions & 0 deletions MediaBrowser.Controller/Entities/Audio/Audio.cs
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,31 @@ protected override string CreateSortName()
/// <returns>System.String.</returns>
protected override string CreateUserDataKey()
{
if (ConfigurationManager.Configuration.EnableStandaloneMusicKeys)
{
var songKey = IndexNumber.HasValue ? IndexNumber.Value.ToString("0000") : string.Empty;


if (ParentIndexNumber.HasValue)
{
songKey = ParentIndexNumber.Value.ToString("0000") + "-" + songKey;
}
songKey+= Name;

if (!string.IsNullOrWhiteSpace(Album))
{
songKey = Album + "-" + songKey;
}

var albumArtist = AlbumArtists.FirstOrDefault();
if (!string.IsNullOrWhiteSpace(albumArtist))
{
songKey = albumArtist + "-" + songKey;
}

return songKey;
}

var parent = AlbumEntity;

if (parent != null)
Expand Down
23 changes: 21 additions & 2 deletions MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,17 @@ public MusicArtist MusicArtist
{
get
{
return GetParents().OfType<MusicArtist>().FirstOrDefault();
var artist = GetParents().OfType<MusicArtist>().FirstOrDefault();

if (artist == null)
{
var name = AlbumArtist;
if (!string.IsNullOrWhiteSpace(name))
{
artist = LibraryManager.GetArtist(name);
}
}
return artist;
}
}

Expand Down Expand Up @@ -106,6 +116,15 @@ protected override string CreateUserDataKey()
return "MusicAlbum-Musicbrainz-" + id;
}

if (ConfigurationManager.Configuration.EnableStandaloneMusicKeys)
{
var albumArtist = AlbumArtist;
if (!string.IsNullOrWhiteSpace(albumArtist))
{
return albumArtist + "-" + Name;
}
}

return base.CreateUserDataKey();
}

Expand All @@ -125,7 +144,7 @@ public AlbumInfo GetLookupInfo()

id.AlbumArtists = AlbumArtists;

var artist = GetParents().OfType<MusicArtist>().FirstOrDefault();
var artist = MusicArtist;

if (artist != null)
{
Expand Down
8 changes: 8 additions & 0 deletions MediaBrowser.Controller/Entities/Movies/Movie.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.Serialization;
using System.Threading;
using System.Threading.Tasks;
using CommonIO;
Expand Down Expand Up @@ -85,6 +86,13 @@ public Movie()
/// <value>The name of the TMDB collection.</value>
public string TmdbCollectionName { get; set; }

[IgnoreDataMember]
public string CollectionName
{
get { return TmdbCollectionName; }
set { TmdbCollectionName = value; }
}

/// <summary>
/// Gets the trailer ids.
/// </summary>
Expand Down
2 changes: 1 addition & 1 deletion MediaBrowser.LocalMetadata/Parsers/MovieXmlParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ protected override void FetchDataFromXmlNode(XmlReader reader, MetadataResult<T>

if (!string.IsNullOrWhiteSpace(val) && movie != null)
{
movie.TmdbCollectionName = val;
movie.CollectionName = val;
}

break;
Expand Down
3 changes: 2 additions & 1 deletion MediaBrowser.Model/Configuration/ServerConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,8 @@ public class ServerConfiguration : BaseApplicationConfiguration
public bool DownloadImagesInAdvance { get; set; }

public bool EnableAnonymousUsageReporting { get; set; }

public bool EnableStandaloneMusicKeys { get; set; }

/// <summary>
/// Initializes a new instance of the <see cref="ServerConfiguration" /> class.
/// </summary>
Expand Down
6 changes: 0 additions & 6 deletions MediaBrowser.Model/Dto/BaseItemDto.cs
Original file line number Diff line number Diff line change
Expand Up @@ -206,12 +206,6 @@ public class BaseItemDto : IHasProviderIds, IHasPropertyChangedEvent, IItemDto,
/// <value>The short overview.</value>
public string ShortOverview { get; set; }

/// <summary>
/// Gets or sets the name of the TMDB collection.
/// </summary>
/// <value>The name of the TMDB collection.</value>
public string TmdbCollectionName { get; set; }

/// <summary>
/// Gets or sets the taglines.
/// </summary>
Expand Down
1 change: 1 addition & 0 deletions MediaBrowser.Model/LiveTv/LiveTvOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public class TunerHostInfo
public string M3UUrl { get; set; }
public string FriendlyName { get; set; }
public int Tuners { get; set; }
public string DiseqC { get; set; }

public int DataVersion { get; set; }

Expand Down
5 changes: 0 additions & 5 deletions MediaBrowser.Model/Querying/ItemFields.cs
Original file line number Diff line number Diff line change
Expand Up @@ -235,11 +235,6 @@ public enum ItemFields
/// </summary>
VoteCount,

/// <summary>
/// The TMDB collection name
/// </summary>
TmdbCollectionName,

/// <summary>
/// The trailer url of the item
/// </summary>
Expand Down
4 changes: 2 additions & 2 deletions MediaBrowser.Providers/Manager/ProviderManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1022,8 +1022,8 @@ private async Task RefreshArtist(MusicArtist item, MetadataRefreshOptions option
.ToList();

var musicArtists = albums
.Select(i => i.GetParent())
.OfType<MusicArtist>()
.Select(i => i.MusicArtist)
.Where(i => i != null)
.ToList();

var musicArtistRefreshTasks = musicArtists.Select(i => i.ValidateChildren(new Progress<double>(), cancellationToken, options, true));
Expand Down
16 changes: 13 additions & 3 deletions MediaBrowser.Providers/MediaInfo/AudioImageProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,21 @@ public async Task<DynamicImageResponse> GetImage(Audio item, List<MediaStream> i

private string GetAudioImagePath(Audio item)
{
var album = item.AlbumEntity;

var filename = item.Album ?? string.Empty;
filename += string.Join(",", item.Artists.ToArray());
filename += album == null ? item.Id.ToString("N") + "_primary" + item.DateModified.Ticks : album.Id.ToString("N") + album.DateModified.Ticks + "_primary";

if (!string.IsNullOrWhiteSpace(item.Album))
{
filename += "_" + item.Album;
}
else if (!string.IsNullOrWhiteSpace(item.Name))
{
filename += "_" + item.Name;
}
else
{
filename += "_" + item.Id.ToString("N");
}

filename = filename.GetMD5() + ".jpg";

Expand Down
2 changes: 1 addition & 1 deletion MediaBrowser.Providers/Movies/GenericMovieDbInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ private void ProcessMainInfo(MetadataResult<T> resultItem, TmdbSettingsResult se

if (movieItem != null)
{
movieItem.TmdbCollectionName = movieData.belongs_to_collection.name;
movieItem.CollectionName = movieData.belongs_to_collection.name;
}
}

Expand Down
4 changes: 2 additions & 2 deletions MediaBrowser.Providers/Movies/MovieMetadataService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ protected override void MergeData(MetadataResult<Movie> source, MetadataResult<M
var sourceItem = source.Item;
var targetItem = target.Item;

if (replaceData || string.IsNullOrEmpty(targetItem.TmdbCollectionName))
if (replaceData || string.IsNullOrEmpty(targetItem.CollectionName))
{
targetItem.TmdbCollectionName = sourceItem.TmdbCollectionName;
targetItem.CollectionName = sourceItem.CollectionName;
}
}
}
Expand Down
10 changes: 0 additions & 10 deletions MediaBrowser.Server.Implementations/Dto/DtoService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1378,16 +1378,6 @@ private void AttachBasicFields(BaseItemDto dto, BaseItem item, BaseItem owner, D
}
}

// Add MovieInfo
var movie = item as Movie;
if (movie != null)
{
if (fields.Contains(ItemFields.TmdbCollectionName))
{
dto.TmdbCollectionName = movie.TmdbCollectionName;
}
}

var hasSpecialFeatures = item as IHasSpecialFeatures;
if (hasSpecialFeatures != null)
{
Expand Down
5 changes: 0 additions & 5 deletions MediaBrowser.Server.Implementations/Library/LibraryManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1044,11 +1044,6 @@ public IEnumerable<MusicArtist> GetArtists(IEnumerable<IHasArtist> items)
return names;
}

private void SetPropertiesFromSongs(MusicArtist artist, IEnumerable<IHasMetadata> items)
{

}

/// <summary>
/// Validate and refresh the People sub-set of the IBN.
/// The items are stored in the db but not loaded into memory until actually requested by an operation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,21 @@ private async void AddDevice(string location)

if (existing == null)
{
if (string.IsNullOrWhiteSpace(info.M3UUrl))
{
return;
}

await _liveTvManager.SaveTunerHost(new TunerHostInfo
{
Type = SatIpHost.DeviceType,
Url = location,
DataVersion = 1,
DeviceId = info.DeviceId,
FriendlyName = info.FriendlyName,
Tuners = info.Tuners
Tuners = info.Tuners,
M3UUrl = info.M3UUrl,
IsEnabled = true

}).ConfigureAwait(false);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
},
"devDependencies": {},
"ignore": [],
"version": "1.0.43",
"_release": "1.0.43",
"version": "1.0.44",
"_release": "1.0.44",
"_resolution": {
"type": "version",
"tag": "1.0.43",
"commit": "5c5aeb79353f3a7d3e20a456d6f1506d660f8626"
"tag": "1.0.44",
"commit": "31d79dade27d28bad1c45ad30da03550493c17ca"
},
"_source": "git://github.com/MediaBrowser/Emby.ApiClient.Javascript.git",
"_target": "~1.0.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -308,9 +308,6 @@
var existingServer = existingServers.length ? existingServers[0] : {};
existingServer.DateLastAccessed = new Date().getTime();
existingServer.LastConnectionMode = ConnectionMode.Manual;
if (existingServer.LastConnectionMode == ConnectionMode.Local) {
existingServer.DateLastLocalConnection = new Date().getTime();
}
existingServer.ManualAddress = apiClient.serverAddress();
apiClient.serverInfo(existingServer);

Expand Down Expand Up @@ -412,10 +409,6 @@

if (options.updateDateLastAccessed !== false) {
server.DateLastAccessed = new Date().getTime();

if (server.LastConnectionMode == ConnectionMode.Local) {
server.DateLastLocalConnection = new Date().getTime();
}
}
server.Id = result.ServerId;

Expand Down Expand Up @@ -869,8 +862,7 @@
var info = {
Id: foundServer.Id,
LocalAddress: convertEndpointAddressToManualAddress(foundServer) || foundServer.Address,
Name: foundServer.Name,
DateLastLocalConnection: new Date().getTime()
Name: foundServer.Name
};

info.LastConnectionMode = info.ManualAddress ? ConnectionMode.Manual : ConnectionMode.Local;
Expand Down Expand Up @@ -1165,10 +1157,6 @@

if (options.updateDateLastAccessed !== false) {
server.DateLastAccessed = new Date().getTime();

if (connectionMode == ConnectionMode.Local) {
server.DateLastLocalConnection = new Date().getTime();
}
}
credentialProvider.addOrUpdateServer(credentials.Servers, server);
credentialProvider.credentials(credentials);
Expand Down Expand Up @@ -1517,33 +1505,7 @@
});
}

return self.getAvailableServers().then(function (servers) {

var currentServerId = apiClient.serverInfo().Id;
var matchedServers = servers.filter(function (s) {
return stringEqualsIgnoreCase(s.Id, currentServerId);
});

var match = matchedServers.length ? matchedServers[0] : null;
var dateLastLocalConnection = match ? match.DateLastLocalConnection : null;
if (!dateLastLocalConnection) {

return apiClient.getJSON(apiClient.getUrl('System/Endpoint')).then(function (info) {

if (info.IsInNetwork) {

updateDateLastLocalConnection(currentServerId);
return apiClient.getRegistrationInfo(feature);
} else {
return {};
}

});

} else {
return apiClient.getRegistrationInfo(feature);
}
});
return apiClient.getRegistrationInfo(feature);
};

function isConnectUserSupporter() {
Expand All @@ -1559,22 +1521,6 @@
return false;
}

function updateDateLastLocalConnection(serverId) {

var credentials = credentialProvider.credentials();
var servers = credentials.Servers.filter(function (s) {
return s.Id == serverId;
});

var server = servers.length ? servers[0] : null;

if (server) {
server.DateLastLocalConnection = new Date().getTime();
credentialProvider.addOrUpdateServer(credentials.Servers, server);
credentialProvider.credentials(credentials);
}
}

function addAppInfoToConnectRequest(request) {
request.headers = request.headers || {};
request.headers['X-Application'] = appName + '/' + appVersion;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@
if (server.ConnectServerId) {
existing.ConnectServerId = server.ConnectServerId;
}
existing.DateLastLocalConnection = Math.max(existing.DateLastLocalConnection || 0, server.DateLastLocalConnection || 0);

return existing;
}
Expand Down
Loading

0 comments on commit 72207f9

Please sign in to comment.