<commit_before>package subsonic

import (
	"encoding/xml"
	"log"
	"net/http"
	"strconv"
	"strings"

	"github.com/mdlayher/wavepipe/api"
	"github.com/mdlayher/wavepipe/data"

	"github.com/gorilla/context"
	"github.com/unrolled/render"
)

// MusicDirectoryContainer contains a list of emulated Subsonic music folders
type MusicDirectoryContainer struct {
	// Container name
	XMLName xml.Name `xml:"directory,omitempty"`

	// Attributes
	ID   string `xml:"id,attr"`
	Name string `xml:"name,attr"`

	Children []Child `xml:"child"`
}

type Child struct {
	// Container name
	XMLName xml.Name `xml:"child,omitempty"`

	// Attributes
	ID       string `xml:"id,attr"`
	Title    string `xml:"title,attr"`
	Album    string `xml:"album,attr"`
	Artist   string `xml:"artist,attr"`
	IsDir    bool   `xml:"isDir,attr"`
	CoverArt int    `xml:"coverArt,attr"`
	Created  string `xml:"created,attr"`
}

// GetMusicDirectory is used in Subsonic to return a list of filesystem items
// contained in a directory, including songs, folders, etc.
func GetMusicDirectory(res http.ResponseWriter, req *http.Request) {
	// Retrieve render<commit_msg>subsonic/getMusicDirectory: add header comment on Child<commit_after>package subsonic

import (
	"encoding/xml"
	"log"
	"net/http"
	"strconv"
	"strings"

	"github.com/mdlayher/wavepipe/api"
	"github.com/mdlayher/wavepipe/data"

	"github.com/gorilla/context"
	"github.com/unrolled/render"
)

// MusicDirectoryContainer contains a list of emulated Subsonic music folders
type MusicDirectoryContainer struct {
	// Container name
	XMLName xml.Name `xml:"directory,omitempty"`

	// Attributes
	ID   string `xml:"id,attr"`
	Name string `xml:"name,attr"`

	Children []Child `xml:"child"`
}

// Child is any item displayed to Subsonic when browsing using getMusicDirectory
type Child struct {
	// Container name
	XMLName xml.Name `xml:"child,omitempty"`

	// Attributes
	ID       string `xml:"id,attr"`
	Title    string `xml:"title,attr"`
	Album    string `xml:"album,attr"`
	Artist   string `xml:"artist,attr"`
	IsDir    bool   `xml:"isDir,attr"`
	CoverArt int    `xml:"coverArt,attr"`
	Created  string `xml:"created,attr"`
}

// GetMusicDirectory is used in Subsonic to return a list of filesystem items
// contained in a directory, including songs, folders, etc.
func GetMusicDirectory(res http.ResponseWriter, req *http.Request) {
	// Retrieve render
{'fraction_non_alphanumeric': 0.12410299704516674, 'fraction_numerical': 0.0, 'mean_word_length': 4.448275862068965, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 30}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7294611', 'n_tokens_mistral': 787, 'n_tokens_neox': 765, 'n_words': 207}