public OptionPageSetup(HelperKinskyJukebox aHelper)
            : base("Setup")
        {
            iHelper = aHelper;

            iCollectionLocation = new OptionFolderPath("scandirectory", "Scan Directory", "Select the directory to scan for music (root directory of your music collection)", "");
            Add(iCollectionLocation);

            iCollectionHttpLocation = new OptionUri("scanurl", "URL of Scan Directory", "Web accessible address of your scan directory." + Environment.NewLine + "If you are using a NAS based webserver, please enter a valid http location (i.e. http://<ip address of nas>/<music share>)." + Environment.NewLine + "Click the 'Test' button to insure this location opens in a web browser and points to your Scan Directory (root directory of your music collection)." + Environment.NewLine + "Otherwise, you can allow Kinsky Jukebox to run as an Http server by ticking this option box (valid network interface must be selected)." + Environment.NewLine + "Kinsky Jukebox would need to remain running during music playback as it would be serving the music to your DS device.", "http://");
            iCollectionHttpLocation.IncludeTestButton();
            Add(iCollectionHttpLocation);

            iUseHttpServer = new OptionBool("usehttpserver", "Use KinskyJukebox as Http Server", "Use Kinsky Jukebox in place of a dedicated http server for your music (valid network interface must be selected, Kinsky Jukebox would need to remain running during music playback as it would be serving the music to your DS device). URL of scan directory is ignored if this setting is enabled.", false);
            Add(iUseHttpServer);

            iCompilationsFolder = new OptionFolderName("compliationsfoldername", "Compilations Folder Name", "Select the folder where your compilation albums are stored. By default any folder name containing 'compilation' or 'various' will be classed as a compilation folder." + Environment.NewLine + "Should reside within your Scan Directory (root directory of your music collection).", "");
            Add(iCompilationsFolder);

            iRandomize = new OptionBool("randomiselargeplaylists", "Randomize Large Playlists", "Randomize playlists larger than " + MediaCollection.kPlaylistMaxTracks + " tracks. Otherwise the first " + MediaCollection.kPlaylistMaxTracks + " tracks only will be used.", true);
            Add(iRandomize);

            // linked options
            iCollectionHttpLocation.Enabled   = !iUseHttpServer.Native;
            EventUseHttpServerChanged        += UseHttpServerChanged;
            iUseHttpServer.Enabled            = (iHelper.Stack.Status.State == EStackState.eOk);
            iHelper.Stack.EventStatusChanged += EventStackStatusChanged; // linked to iUseHttpServer
        }
Exemple #2
0
        public Upnp.upnpObject GetUpnpMusicTrack(OptionPageSetup aUserOptionsSetup, HelperKinskyJukebox aHelper)
        {
            Upnp.upnpObject upnpMusicTrack = null;

            if (DiscCount > 0)
            {
                upnpMusicTrack = new Upnp.musicTrack();
            }
            else
            {
                upnpMusicTrack = new Upnp.musicTrack();
            }
            upnpMusicTrack.Id    = FilePath;
            upnpMusicTrack.Title = Title;
            ((Upnp.musicTrack)upnpMusicTrack).Album.Add(Album);
            ((Upnp.musicTrack)upnpMusicTrack).Genre.Add(Genre);
            ((Upnp.musicTrack)upnpMusicTrack).OriginalTrackNumber = (int)Track;
            if (upnpMusicTrack is Upnp.musicTrack)
            {
                ((Upnp.musicTrack)upnpMusicTrack).OriginalDiscNumber = (int)Disc;
                ((Upnp.musicTrack)upnpMusicTrack).OriginalDiscCount  = (int)DiscCount;
            }
            ((Upnp.musicTrack)upnpMusicTrack).Date = Year;

            Upnp.artist performer = new Upnp.artist();
            performer.Artist = Artist;
            performer.Role   = "Performer";
            ((Upnp.musicTrack)upnpMusicTrack).Artist.Add(performer);

            Upnp.artist composer = new Upnp.artist();
            composer.Role   = "Composer";
            composer.Artist = Composer;
            ((Upnp.musicTrack)upnpMusicTrack).Artist.Add(composer);

            Upnp.artist albumArtist = new Upnp.artist();
            albumArtist.Artist = AlbumArtist;
            albumArtist.Role   = "AlbumArtist";
            ((Upnp.musicTrack)upnpMusicTrack).Artist.Add(albumArtist);

            Upnp.artist conductor = new Upnp.artist();
            conductor.Artist = Conductor;
            conductor.Role   = "Conductor";
            ((Upnp.musicTrack)upnpMusicTrack).Artist.Add(conductor);

            Upnp.resource resource = new Upnp.resource();
            resource.Duration     = Duration;
            resource.Uri          = GetUri(FilePath, aHelper);
            resource.ProtocolInfo = "http-get:*:" + MimeType + ":*";
            upnpMusicTrack.Res.Add(resource);

            try {
                string art = GetUri(AlbumArtPath, aHelper);
                upnpMusicTrack.AlbumArtUri.Add(art);
                upnpMusicTrack.ArtworkUri.Add(art);
            }
            catch (Exception) { // if AlbumArtPath is invalid, just don't add artwork
            }

            return(upnpMusicTrack);
        }
Exemple #3
0
        public static string GetUri(string aFile, HelperKinskyJukebox aHelper)
        {
            Uri uri = null;

            if (Uri.TryCreate(aFile, UriKind.Absolute, out uri))
            {
                if (uri.Scheme == Uri.UriSchemeHttp)
                {
                    return(aFile); // already a valid uri
                }
            }

            if (aHelper.OptionPageSetup.UseHttpServer)
            {
                return(aHelper.HttpServer.Uri(aFile));
            }
            else
            {
                string rel = aFile.Remove(0, aHelper.OptionPageSetup.CollectionLocation.Length);
                if (rel.StartsWith("/") || rel.StartsWith("\\"))
                {
                    rel = rel.Remove(0, 1);
                }
                string path = aHelper.OptionPageSetup.CollectionHttpLocation;
                if (!(path.EndsWith("/") || path.EndsWith("\\")))
                {
                    path += "/";
                }
                rel   = rel.Replace("\\", "/");
                path += rel;
                uri   = new Uri(path);
                return(uri.AbsoluteUri);
            }
        }
Exemple #4
0
 public MediaCollection(HelperKinskyJukebox aHelper, DNodeCreated aNodeCreated, DProgressChanged aProgressChanged)
 {
     iCollectionDir   = aHelper.OptionPageSetup.CollectionLocation;
     iNodeCreated     = aNodeCreated;
     iProgressChanged = aProgressChanged;
     iHelper          = aHelper;
 }
Exemple #5
0
 public FormUpdate(HelperKinskyJukebox aHelper, DEventCheckForUpdatesComplete aEventCheckForUpdatesComplete, DEventDownloadUpdateComplete aEventDownloadUpdateComplete)
 {
     iHelper = aHelper;
     iEventCheckForUpdatesComplete = aEventCheckForUpdatesComplete;
     iEventDownloadUpdateComplete  = aEventDownloadUpdateComplete;
     InitializeComponent();
     this.Icon = Icon.FromHandle(Properties.Resources.Update.GetHicon());
 }
Exemple #6
0
 public FormWizard(HelperKinskyJukebox aHelper, FormKinskyJukebox aForm)
 {
     InitializeComponent();
     this.Icon             = Icon.FromHandle(Properties.Resources.Wizard.GetHicon());
     iParentForm           = aForm;
     wizardMessageBox.Text = "Click the Start button to begin the wizard";
     Step    = Steps.eNotStarted;
     iHelper = aHelper;
 }
Exemple #7
0
 public Presets(HelperKinskyJukebox aHelper, TreeNodeCollection aUserCreatedNodes, DProgressChanged aProgressChanged, DNodeCreated aNodeCreated)
 {
     iPresetDir        = DirectoryPath(aHelper.OptionPageSetup);
     iManifestPath     = iPresetDir + "manifest.xml";
     iUserCreatedNodes = aUserCreatedNodes;
     iProgressChanged  = aProgressChanged;
     iNodeCreated      = aNodeCreated;
     iPlaylist         = new Playlist();
     iHelper           = aHelper;
 }
Exemple #8
0
 public static bool IsCompilation(string aFileName, HelperKinskyJukebox aHelper)
 {
     if (aHelper.OptionPageSetup.CompilationsFolder != null && aHelper.OptionPageSetup.CompilationsFolder != "")
     {
         return(Path.GetDirectoryName(aFileName).ToLowerInvariant().Contains(aHelper.OptionPageSetup.CompilationsFolder.ToLowerInvariant()));
     }
     else
     {
         return(Path.GetDirectoryName(aFileName).ToLowerInvariant().Contains("compilation") ||
                Path.GetDirectoryName(aFileName).ToLowerInvariant().Contains("various"));
     }
 }
Exemple #9
0
 public FormDevices(HelperKinskyJukebox aHelper)
 {
     iHelper = aHelper;
     InitializeComponent();
     this.Icon = Icon.FromHandle(Properties.Resources.Export.GetHicon());
     try {
         iPresetUri           = Presets.UriPath(aHelper);
         iPresetDir           = Presets.DirectoryPath(aHelper.OptionPageSetup);
         locationTextBox.Text = Parameter.kNameJukeboxPresetPrefix + ":  " + iPresetUri;
     }
     catch (Exception e) {
         Linn.UserLog.WriteLine("Sync with Linn DS Failed: " + e.Message);
         MessageBox.Show(e.Message, "Sync with Linn DS Failed", MessageBoxButtons.OK, MessageBoxIcon.Hand);
         Close();
     }
 }
Exemple #10
0
        static void Main(string[] aArgs)
        {
            // create the application helper, adding a form based crash log dumper
            iHelper = new HelperKinskyJukebox(aArgs);
            iHelper.AddCrashLogDumper(new CrashLogDumperForm(iHelper.Title, iHelper.Product, iHelper.Version, iHelper.Icon));
            iHelper.ProcessOptionsFileAndCommandLine();

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            // ensure that all unhandled exceptions in this thread bypass the
            // Application class handlers and let the AppDomain handlers that
            // have been added in to the helper handle it
            if (iHelper.IsWindows)
            {
                Application.SetUnhandledExceptionMode(UnhandledExceptionMode.ThrowException);
            }
            else
            {
                Application.ThreadException += UnhandledExceptionNonWindows;
            }

            Application.Run(new FormKinskyJukebox(iHelper));
            iHelper.Dispose();
        }
Exemple #11
0
        public TrackMetadata(string aFile, HelperKinskyJukebox aHelper)
        {
            // File Info
            FilePath = Path.GetFullPath(aFile);
            try {
                AlbumArtPath = FindArtwork(Path.GetDirectoryName(FilePath));
            }
            catch (Exception) {
            }
            try {
                AgeInDays = (DateTime.Today - File.GetCreationTime(aFile)).Days;
            }
            catch (Exception) {
            }

            // Check for compilation
            try {
                IsCompilation = MediaCollection.IsCompilation(FilePath, aHelper);
            }
            catch (Exception) {
            }

            bool artistVarious = (aHelper.OptionPageOrganisation.IgnoreCompilations && IsCompilation);

            try {
                // populate metadata from tags if it is there
                TagLib.File tagFile = TagLib.File.Create(aFile);
                Title       = tagFile.Tag.Title;
                Album       = tagFile.Tag.Album;
                Artist      = tagFile.Tag.FirstPerformer;
                AlbumArtist = tagFile.Tag.FirstAlbumArtist;
                Genre       = tagFile.Tag.FirstGenre;
                Composer    = tagFile.Tag.FirstComposer;
                Conductor   = tagFile.Tag.Conductor;
                Track       = tagFile.Tag.Track;
                Disc        = tagFile.Tag.Disc;
                DiscCount   = tagFile.Tag.DiscCount;
                Year        = tagFile.Tag.Year.ToString();
                Duration    = new Upnp.Time((int)tagFile.Properties.Duration.TotalSeconds).ToString();
                MimeType    = tagFile.MimeType;
            }
            catch (Exception) {
            }

            // deal with missing data and unwanted data
            if (Title == null)
            {
                Title = Path.GetFileNameWithoutExtension(aFile);
            }
            if (Album == null)
            {
                Album = "Unknown";
            }
            if (Artist == null)
            {
                Artist = "Unknown";
            }
            else if (artistVarious)
            {
                Artist = kCompilationsArtist;
            }
            if (AlbumArtist == null)
            {
                AlbumArtist = "Unknown";
            }
            if (Genre == null)
            {
                Genre = "Unknown";
            }
            if (Composer == null)
            {
                Composer = "Unknown";
            }
            if (Year == null || Year.Length != 4)
            {
                Year = "Unknown";
            }
            if (Duration == null)
            {
                Duration = "Unknown";
            }
            if (Conductor == null)
            {
                Conductor = "Unknown";
            }
            if (MimeType == null)
            {
                MimeType = "Unknown";
            }
            if (aHelper.OptionPageOrganisation.SortByYear)
            {
                Album = Year + "/" + Album;
            }
        }
Exemple #12
0
        public FormPrint(HelperKinskyJukebox aHelper, TreeView aPresets, bool aPreview, uint aPresetCount, DProgressChanged aProgressChanged)
        {
            iHelper                 = aHelper;
            iTreeViewPreset         = aPresets;
            iDocumentPreview        = aPreview;
            iPresetCount            = aPresetCount;
            iProgressChanged        = aProgressChanged;
            iUserOptionsApplication = aHelper.ApplicationOptions;
            InitializeComponent();
            if (aPreview)
            {
                this.Icon = Icon.FromHandle(Properties.Resources.PrintPreview.GetHicon());
            }
            else
            {
                this.Icon = Icon.FromHandle(Properties.Resources.Print.GetHicon());
            }

            int index = 0;

            printSectionCheckedListBox.Items.Add(ApplicationOptions.kToc);
            printSectionCheckedListBox.SetItemChecked(index++, iHelper.ApplicationOptions.IsPrintSectionEnabled(ApplicationOptions.kToc));
            foreach (TreeNode bookmark in aPresets.Nodes)
            {
                printSectionCheckedListBox.Items.Add(bookmark.Text);
                if (bookmark.Text == MediaCollection.SortTypeToString(MediaCollection.SortType.eAll))
                {
                    iAllIndex = index;
                }
                printSectionCheckedListBox.SetItemChecked(index++, iHelper.ApplicationOptions.IsPrintSectionEnabled(bookmark.Text));
            }
            switch (iUserOptionsApplication.PrintPageLayout)
            {
            case ApplicationOptions.PrintPageLayoutOptions.ePortraitWithTrackDetails: {
                iPageLayoutTrackDetailsPortrait.Checked = true;
                break;
            }

            case ApplicationOptions.PrintPageLayoutOptions.ePortraitWithoutTrackDetails: {
                iPageLayoutAlbumArtOnlyPortrait.Checked = true;
                break;
            }

            case ApplicationOptions.PrintPageLayoutOptions.eLandscapeWithTrackDetails: {
                iPageLayoutTrackDetailsLandscape.Checked = true;
                break;
            }

            case ApplicationOptions.PrintPageLayoutOptions.eLandscapeWithoutTrackDetails: {
                iPageLayoutAlbumArtOnlyLandscape.Checked = true;
                break;
            }
            }

            iPagesPerSheet.SelectedIndex = iUserOptionsApplication.PrintPagesPerSheetIndex;
            iPrintOrderBooklet.Checked   = iUserOptionsApplication.PrintOrderBooklet;

            if (iUserOptionsApplication.PrintDocumentType == ApplicationOptions.PrintDocumentTypeOptions.eRtf)
            {
                iDocTypeRtf.Checked = true;
            }
            else
            {
                iDocTypePdf.Checked = true;
            }
        }
Exemple #13
0
 public Presets(HelperKinskyJukebox aHelper, TreeNodeCollection aUserCreatedNodes, DProgressChanged aProgressChanged) :
     this(aHelper, aUserCreatedNodes, aProgressChanged, null)
 {
 }
Exemple #14
0
 public static string UriPath(HelperKinskyJukebox aHelper)
 {
     return(TrackMetadata.GetUri(Presets.DirectoryPath(aHelper.OptionPageSetup), aHelper));
 }