예제 #1
0
    protected virtual void OnBtnQueueSongClicked(object sender, System.EventArgs e)
    {
        HTreeNode theNode = tvLibrary.SelectedNode;

        // Check if node has children
        if (theNode.Nodes.Count > 0)
        {
            // Will add all children to queue
        }
        else
        {
            // Node is a leaf (song)
            SubsonicItem theItem = GetNodeItem(theNode);

            // Confirm that the item is  asong
            if (theItem.itemType == SubsonicItem.SubsonicItemType.Song)
            {
                //slPlaylist.Items.Add(theItem);

                Dictionary <string, string> songId = new Dictionary <string, string>();
                songId.Add("id", theItem.id);
                string streamURL = Subsonic.BuildDirectURL("download.view", songId);

                System.Diagnostics.Process proc = new System.Diagnostics.Process();
                proc.StartInfo.FileName  = "vlc";
                proc.StartInfo.Arguments = "--one-instance --playlist-enqueue " + streamURL;
                proc.Start();
            }
        }
    }
예제 #2
0
    private SubsonicItem GetNodeItem(HTreeNode theNode)
    {
        // Get path to the selected node
        Queue <string> nodePath = GetNodePath(theNode);

        // Dive into library to selected node
        SubsonicItem thisItem = Subsonic.MyLibrary;

        while (nodePath.Count > 0)
        {
            thisItem = thisItem.GetChildByName(nodePath.Dequeue());
        }

        return(thisItem);
    }
예제 #3
0
    protected virtual void OnBtnLogin2Clicked(object sender, System.EventArgs e)
    {
        string server    = tbServer.Text;
        string user      = tbUsername.Text;
        string passw0rdd = tbPaassw0rd.Text;

        string loginResult = Subsonic.LogIn(server, user, passw0rdd);

        Console.WriteLine("Login Result: " + loginResult);

        SubsonicItem thisLibrary = Subsonic.MyLibrary;

        foreach (SubsonicItem artist in thisLibrary.children)
        {
            HTreeNode artistNode = new HTreeNode(artist.name);
            tvLibrary.Nodes.Add(artistNode);

            // Adding a dummy node for the artist
            artistNode.Nodes.Add(new HTreeNode(""));
        }
    }
예제 #4
0
        private void lbAlbums_SelectedIndexChanged(object sender, EventArgs e)
        {
            SubsonicItem theItem = (SubsonicItem)lbAlbums.SelectedItem;

            if (theItem.ItemType == SubsonicItem.SubsonicItemType.Folder)
            {
                if (theItem.Name == "..")
                {
                    AlbumListHistory.Pop();
                }
                else
                {
                    AlbumListHistory.Push(LastAlbumId);
                }
                UpdateAlbumListView(theItem.id);
            }
            else if (theItem.ItemType == SubsonicItem.SubsonicItemType.Song)
            {
                thePlayer.addToPlaylist((Song)theItem);
                thePlayer.play();
            }
        }
예제 #5
0
    void tvLibraryNodeExpanded(object sender, NodeEventArgs args)
    {
        // Fetch any items inside the node...
        HTreeNode thisNode = args.Node;

        // Check to see if it has any children
        if (thisNode.Nodes.Count == 1 && thisNode.Nodes[0].Text == "")
        {
            // Node child is a dummy
            thisNode.Nodes[0].Text = "Loading...";

            // Get path to the selected node to expandsimp
            Queue <string> nodePath = GetNodePath(thisNode);

            // Dive into library to selected node
            SubsonicItem thisItem = Subsonic.MyLibrary;
            while (nodePath.Count > 0)
            {
                thisItem = thisItem.GetChildByName(nodePath.Dequeue());
            }

            // Should now have the correct selected item
            foreach (SubsonicItem child in thisItem.children)
            {
                HTreeNode childNode = new HTreeNode(child.name);
                thisNode.Nodes.Add(childNode);

                // Adding a dummy node for any Folders
                if (child.itemType == SubsonicItem.SubsonicItemType.Folder)
                {
                    childNode.Nodes.Add(new HTreeNode(""));
                }
            }

            // Remove dummy node
            thisNode.Nodes.RemoveAt(0);
        }
    }