many changes
This commit is contained in:
@@ -562,11 +562,15 @@ impl MediaRepository for OnlineRepository {
|
||||
let mut ungrouped = Vec::new();
|
||||
|
||||
for item in items {
|
||||
if let Some(album_id) = &item.album_id {
|
||||
debug!("[get_recently_played_audio] Grouping item '{}' into album '{}'", item.name, album_id);
|
||||
album_map.entry(album_id.clone()).or_insert_with(Vec::new).push(item);
|
||||
// Use album_id if available, fall back to album_name for grouping
|
||||
let group_key = item.album_id.clone()
|
||||
.or_else(|| item.album_name.clone());
|
||||
|
||||
if let Some(key) = group_key {
|
||||
debug!("[get_recently_played_audio] Grouping item '{}' into album '{}'", item.name, key);
|
||||
album_map.entry(key).or_insert_with(Vec::new).push(item);
|
||||
} else {
|
||||
debug!("[get_recently_played_audio] No album_id for item: '{}'", item.name);
|
||||
debug!("[get_recently_played_audio] No album_id or album_name for item: '{}'", item.name);
|
||||
ungrouped.push(item);
|
||||
}
|
||||
}
|
||||
@@ -1025,6 +1029,50 @@ impl MediaRepository for OnlineRepository {
|
||||
url
|
||||
}
|
||||
|
||||
fn get_subtitle_url(
|
||||
&self,
|
||||
item_id: &str,
|
||||
media_source_id: &str,
|
||||
stream_index: i32,
|
||||
format: &str,
|
||||
) -> String {
|
||||
format!(
|
||||
"{}/Videos/{}/{}/Subtitles/{}/{}",
|
||||
self.server_url,
|
||||
item_id,
|
||||
media_source_id,
|
||||
stream_index,
|
||||
format
|
||||
)
|
||||
}
|
||||
|
||||
fn get_video_download_url(
|
||||
&self,
|
||||
item_id: &str,
|
||||
quality: &str,
|
||||
media_source_id: Option<&str>,
|
||||
) -> String {
|
||||
let mut url = format!("{}/Videos/{}/download", self.server_url, item_id);
|
||||
let mut params = vec![format!("api_key={}", self.access_token)];
|
||||
|
||||
// Add quality parameter if not "original"
|
||||
if quality != "original" {
|
||||
params.push(format!("quality={}", quality));
|
||||
}
|
||||
|
||||
// Add media source ID if provided
|
||||
if let Some(source_id) = media_source_id {
|
||||
params.push(format!("mediaSourceId={}", source_id));
|
||||
}
|
||||
|
||||
if !params.is_empty() {
|
||||
url.push('?');
|
||||
url.push_str(¶ms.join("&"));
|
||||
}
|
||||
|
||||
url
|
||||
}
|
||||
|
||||
async fn mark_favorite(&self, item_id: &str) -> Result<(), RepoError> {
|
||||
let endpoint = format!("/Users/{}/FavoriteItems/{}", self.user_id, item_id);
|
||||
self.post_json(&endpoint, &serde_json::json!({})).await
|
||||
|
||||
Reference in New Issue
Block a user