eonpatapon / mpDris2

MPRIS V2.1 support for mpd
GNU General Public License v3.0
214 stars 46 forks source link

Allow Host to contain a '~' in the configuration #130

Closed kastdeur closed 4 years ago

kastdeur commented 4 years ago

With this PR, one can use a tilde to represent the user's home directory.

In the docs for os.path.expanduser, it says this expansion only takes place when the character is at the front of the string, so this is an easy implementation.

I think it would be nice to have this for music_dir aswell, though I couldn't find the best place for it.

Edit: fixed typo, added url to python docs.

grawity commented 4 years ago

I think it would make more sense either to use startswith() or to not check at all (always expand), rather than look for tilde anywhere in the string.

kastdeur commented 4 years ago

Yeah, I'd say I'm a proponent of always expanding.

Though I find this somehow more readable. No idea why.