osdir.com
mailing list archive F.A.Q. -since 2001!



Subject: [Emms-patches] [COMMIT] *
lisp/emms-source-file.el: Avoid adding duplicates
when dealing with symbolic link. - msg#00002

List: emms-patches-gnu

Mail Archive Navigation:
by Date: Prev Next Date Index by Thread: Prev Next Thread Index

Patch from Stefan Kangas <skangas@xxxxxxxxxx>
---
lisp/emms-source-file.el | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/lisp/emms-source-file.el b/lisp/emms-source-file.el
index 1b0f039..91cd466 100644
--- a/lisp/emms-source-file.el
+++ b/lisp/emms-source-file.el
@@ -162,7 +162,7 @@ value of `emms-source-file-default-directory'."
(string-match emms-source-file-exclude-regexp file))
(emms-playlist-insert-track
(emms-track 'file file))))
- (emms-source-file-directory-tree dir regex)))
+ (emms-source-file-directory-tree (expand-file-name dir) regex)))

;;;###autoload (autoload 'emms-play-dired "emms-source-file" nil t)
;;;###autoload (autoload 'emms-add-dired "emms-source-file" nil t)
@@ -199,7 +199,10 @@ This function uses only emacs functions, so it might be a
bit slow."
(while dirs
(cond
((file-directory-p (car dirs))
- (if (string-match "/\\.\\.?$" (car dirs))
+ (if (or (string-match "/\\.\\.?$" (car dirs))
+ (let ((symlink (file-symlink-p (car dirs))))
+ (and symlink
+ (string-equal dir (substring symlink 0 (string-width
dir))))))
(setq dirs (cdr dirs))
(setq dirs
(condition-case nil
--
debian.1.5.6.1.19.ge6b2



_______________________________________________
Emms-patches mailing list
Emms-patches@xxxxxxx
http://lists.gnu.org/mailman/listinfo/emms-patches

Thread at a glance:

Previous Message by Date:

[Emms-patches] Re: Avoid adding duplicates when dealing with symbolic links.

Stefan Kangas <skangas@xxxxxxxxxx> writes: > Avoid adding duplicates when dealing with symbolic links. [...] Hello, sorry for the delay, been busy with work. Thanks for the patch, I'll have a look at it and then apply it to master. Regards, -- Lucas pgpqpvWwJl5j3.pgp Description: PGP signature _______________________________________________ Emms-patches mailing list Emms-patches@xxxxxxx http://lists.gnu.org/mailman/listinfo/emms-patches

Next Message by Date:

[Emms-patches] Re: Avoid adding duplicates when dealing with symbolic links.

Lucas Bonnet <lucas@xxxxxxxxxxxxx> writes: > sorry for the delay, been busy with work. Thanks for the patch, I'll > have a look at it and then apply it to master. Patch applied, at last. -- Lucas pgpnJInJIe9yF.pgp Description: PGP signature _______________________________________________ Emms-patches mailing list Emms-patches@xxxxxxx http://lists.gnu.org/mailman/listinfo/emms-patches

Previous Message by Thread:

[Emms-patches] Avoid adding duplicates when dealing with symbolic links.

Avoid adding duplicates when dealing with symbolic links. The function `emms-source-file-directory-tree-internal' follows all symlinks. This patch addresses one case where this probably is not what the user would want. Consider the following directory hierarchy: $ pwd /home/skangas/music/incoming $ ls -do Organismen* drwxr-xr-x 2 skangas 4096 Jan 23 16:02 Organismen/ lrwxrwxrwx 1 skangas 35 Jan 30 16:45 Organismen.started -> /home/skangas/music/incoming/Organismen/ Currently, running either `emms-add-find' or `emms-add-directory-tree' with default settings will add the files in the directory twice. I don't believe anyone would want what is in effect duplicates in their play list. I propose the following change: If a symbolic link is found in a directory, it is followed only if it is pointing to a path that is not below the directory that the user requested to add. On the other hand, if there is a symlink to a path that is *not* below the added directory, the user will surely want to add the files there. Therefore, this behavior should probably stay unchanged. Please consider this patch for inclusion. Thanks. - Stefan Kangas P.S. Perhaps some background might help to explain why anyone would want to do something like this with their file system. In my case, I'm using symbolic links to indicate the state of torrents, in order not to accidentally move a directory pointed to by a torrent which is incomplete or still seeding. I might add I'm not the only one doing stuff like this, as is evidented From this feature request for another media player: http://bugzilla.songbirdnest.com/show_bug.cgi?id=15211 --- lisp/emms-source-file.el | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lisp/emms-source-file.el b/lisp/emms-source-file.el index 1b0f039..91cd466 100644 --- a/lisp/emms-source-file.el +++ b/lisp/emms-source-file.el @@ -162,7 +162,7 @@ value of `emms-source-file-default-directory'." (string-match emms-source-file-exclude-regexp file)) (emms-playlist-insert-track (emms-track 'file file)))) - (emms-source-file-directory-tree dir regex))) + (emms-source-file-directory-tree (expand-file-name dir) regex))) ;;;###autoload (autoload 'emms-play-dired "emms-source-file" nil t) ;;;###autoload (autoload 'emms-add-dired "emms-source-file" nil t) @@ -199,7 +199,10 @@ This function uses only emacs functions, so it might be a bit slow." (while dirs (cond ((file-directory-p (car dirs)) - (if (string-match "/\\.\\.?$" (car dirs)) + (if (or (string-match "/\\.\\.?$" (car dirs)) + (let ((symlink (file-symlink-p (car dirs)))) + (and symlink + (string-equal dir (substring symlink 0 (string-width dir)))))) (setq dirs (cdr dirs)) (setq dirs (condition-case nil -- 1.6.6.1 pgpZgVAIBEHPH.pgp Description: PGP signature _______________________________________________ Emms-patches mailing list Emms-patches@xxxxxxx http://lists.gnu.org/mailman/listinfo/emms-patches

Next Message by Thread:

[Emms-patches] [COMMIT] * lisp/emms-player-mpd.el (emms-player-mpd-add): do not add files not recognized by MPD

Patch by David Engster <deng@xxxxxxxxxxxxxxx> --- lisp/emms-player-mpd.el | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/lisp/emms-player-mpd.el b/lisp/emms-player-mpd.el index fa8f911..a8f6b9e 100644 --- a/lisp/emms-player-mpd.el +++ b/lisp/emms-player-mpd.el @@ -805,7 +805,8 @@ Execute CALLBACK with CLOSURE as its first argument when done." ((or (eq type 'playlist) (string-match "\\.\\(m3u\\|pls\\)\\'" name)) (emms-player-mpd-add-playlist name closure callback)) - ((eq type 'file) + ((and (eq type 'file) + (string-match emms-player-mpd-supported-regexp name)) (emms-player-mpd-add-file name closure callback))))) (defun emms-player-mpd-add-several-tracks (tracks closure callback) -- debian.1.5.6.1.19.ge6b2 _______________________________________________ Emms-patches mailing list Emms-patches@xxxxxxx http://lists.gnu.org/mailman/listinfo/emms-patches
blog comments powered by Disqus

Home | News | Sitemap | FAQ | advertise | OSDir is an Inevitable website. GBiz is too!