From 297f567042c91af9b24b4828d930cfea135a03d9 Mon Sep 17 00:00:00 2001 From: Alexander Yakushev Date: Wed, 14 Sep 2011 17:04:17 +0300 Subject: Fix critical bug in caching artists with dash symbols in names --- awesompd.lua | 2 +- jamendo.lua | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/awesompd.lua b/awesompd.lua index 7562873..cd01c3a 100644 --- a/awesompd.lua +++ b/awesompd.lua @@ -1,7 +1,7 @@ --------------------------------------------------------------------------- -- @author Alexander Yakushev -- @copyright 2010-2011 Alexander Yakushev --- @release v1.0.6 +-- @release v1.0.7 --------------------------------------------------------------------------- require('utf8') diff --git a/jamendo.lua b/jamendo.lua index 9104ac3..cc8bc83 100644 --- a/jamendo.lua +++ b/jamendo.lua @@ -1,7 +1,7 @@ --------------------------------------------------------------------------- -- @author Alexander Yakushev -- @copyright 2011 Alexander Yakushev --- @release v1.0.4 +-- @release v1.0.7 --------------------------------------------------------------------------- module('jamendo', package.seeall) @@ -68,7 +68,7 @@ current_request_table = { unit = "track", -- Local variables local jamendo_list = {} local cache_file = awful.util.getdir ("cache").."/jamendo_cache" -local cache_header = "[version=1.0.6]" +local cache_header = "[version=1.0.7]" local album_covers_folder = awful.util.getdir("cache") .. "/jamendo_covers/" local default_mp3_stream = nil local search_template = { fields = { "id", "name" }, @@ -341,7 +341,7 @@ function retrieve_cache() string.find(l,"(%d+)-([^-]+)-(%d+)-(.+)") track = {} track.id = id - track.artist_link_name = artist_link_name + track.artist_link_name = string.gsub(artist_link_name, '\\_', '-') track.album_id = album_id track.display_name = track_name jamendo_list[id] = track @@ -360,7 +360,8 @@ function save_cache() local bus = io.open(cache_file, "w") bus:write(cache_header .. "\n") for id,track in pairs(jamendo_list) do - bus:write(string.format("%s-%s-%s-%s\n", id, track.artist_link_name, + bus:write(string.format("%s-%s-%s-%s\n", id, + string.gsub(track.artist_link_name, '-', '\\_'), track.album_id, track.display_name)) end bus:flush() -- cgit v1.2.3