mirror of
https://github.com/beetbox/beets.git
synced 2025-12-31 21:12:43 +01:00
sampsyo -> beetbox (#1730)
This commit is contained in:
parent
3f804d760c
commit
77d9d3141a
8 changed files with 23 additions and 23 deletions
|
|
@ -113,12 +113,12 @@ or <a href="http://news.ycombinator.com/submitlink?u={{ site.url | cgi_escape }}
|
|||
<h3>Project</h3>
|
||||
<ul class="project">
|
||||
<li>
|
||||
<a href="http://github.com/sampsyo/beets">github</a>,
|
||||
<a href="http://github.com/beetbox/beets">github</a>,
|
||||
<a href="http://bitbucket.org/adrian/beets">bitbucket</a>
|
||||
</li>
|
||||
<li><a href="http://beets.readthedocs.org/">documentation</a></li>
|
||||
<li><a href="http://beets.readthedocs.org/en/latest/faq.html">FAQ</a></li>
|
||||
<li><a href="https://github.com/sampsyo/beets/issues">bug tracker</a></li>
|
||||
<li><a href="https://github.com/beetbox/beets/issues">bug tracker</a></li>
|
||||
<li><a href="http://groups.google.com/group/beets-users">mailing
|
||||
list</a></li>
|
||||
<li><a href="/blog/">blog</a>, <a href="/blog/atom.xml">atom</a></li>
|
||||
|
|
@ -165,7 +165,7 @@ or <a href="http://news.ycombinator.com/submitlink?u={{ site.url | cgi_escape }}
|
|||
Have comments or questions?
|
||||
Contact <a href="http://groups.google.com/group/beets-users">the mailing
|
||||
list</a> or
|
||||
<a href="https://github.com/sampsyo/beets/issues/new">file an issue on GitHub</a>.
|
||||
<a href="https://github.com/beetbox/beets/issues/new">file an issue on GitHub</a>.
|
||||
You can <a href="/donate.html">donate with PayPal or Bitcoin</a>,
|
||||
but please consider a donation to
|
||||
<a href="http://www.rootstrikers.org/donate">Rootstrikers</a> instead.
|
||||
|
|
@ -192,7 +192,7 @@ data-url="{{site.url}}/">tweet beets</a>
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<a id="fork-me" href="https://github.com/sampsyo/beets">Fork me on GitHub</a>
|
||||
<a id="fork-me" href="https://github.com/beetbox/beets">Fork me on GitHub</a>
|
||||
<script type="text/javascript" src="http://apis.google.com/js/plusone.js"></script>
|
||||
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
|
||||
</body>
|
||||
|
|
|
|||
|
|
@ -15,12 +15,12 @@ These are some of the posts you can expect as the blog gets rolling:
|
|||
|
||||
[bluelet]: https://github.com/sampsyo/bluelet
|
||||
[confit]: https://github.com/sampsyo/confit
|
||||
[pyacoustid]: https://github.com/sampsyo/pyacoustid
|
||||
[audioread]: https://github.com/sampsyo/audioread
|
||||
[pyacoustid]: https://github.com/beetbox/pyacoustid
|
||||
[audioread]: https://github.com/beetbox/audioread
|
||||
|
||||
You can subscribe to this blog using its [Atom feed][atom]. The [Jekyll][]
|
||||
source for the site is
|
||||
[on GitHub](https://github.com/sampsyo/beets/tree/gh-pages).
|
||||
[on GitHub](https://github.com/beetbox/beets/tree/gh-pages).
|
||||
|
||||
[Jekyll]: http://jekyllrb.com/
|
||||
[atom]: /blog/atom.xml
|
||||
|
|
|
|||
|
|
@ -24,5 +24,5 @@ Tomahawk will now be able to find tracks from your beets library. Type a query i
|
|||
[bpd]: http://beets.readthedocs.org/page/plugins/bpd.html
|
||||
[web]: http://beets.readthedocs.org/page/plugins/web.html
|
||||
[config]: http://beets.readthedocs.org/page/reference/config.html
|
||||
[git]: https://github.com/sampsyo/beets
|
||||
[git]: https://github.com/beetbox/beets
|
||||
[mercurial]: https://bitbucket.org/adrian/beets
|
||||
|
|
|
|||
|
|
@ -22,13 +22,13 @@ These problems are so basic that I don't think I'm alone in growing uneasy with
|
|||
|
||||
[confitwiki]: http://en.wikipedia.org/wiki/Confit
|
||||
[confit]: https://github.com/sampsyo/confit
|
||||
[import_files]: https://github.com/sampsyo/beets/blob/30ac59f3d20dd3e7ef72456e8fca3e47713d38dc/beets/ui/commands.py#L627
|
||||
[import_files]: https://github.com/beetbox/beets/blob/30ac59f3d20dd3e7ef72456e8fca3e47713d38dc/beets/ui/commands.py#L627
|
||||
[yamlspec]: http://www.yaml.org/spec/1.2/spec.html
|
||||
[replace]: http://beets.readthedocs.org/en/latest/reference/config.html#replace
|
||||
[pathconfig]: http://beets.readthedocs.org/en/latest/reference/config.html#path-format-configuration
|
||||
[yaml]: http://yaml.org/
|
||||
[config]: http://beets.readthedocs.org/en/latest/reference/config.html
|
||||
[firstcommit]: https://github.com/sampsyo/beets/commit/c1ed60af98bd5f18ab0a32bf782260ac15954d8e
|
||||
[firstcommit]: https://github.com/beetbox/beets/commit/c1ed60af98bd5f18ab0a32bf782260ac15954d8e
|
||||
[b1]: http://beets.readthedocs.org/en/latest/changelog.html#b1-june-17-2010
|
||||
|
||||
## Beta 17
|
||||
|
|
|
|||
|
|
@ -59,18 +59,18 @@ A simple solution would be to crank the SQLite lock timeout up to eleven. But I
|
|||
|
||||
To accomplish all of this, beets uses *explicit transactions* that make it obvious where database accesses begin and end. And those transactions are made *mutually exclusive* using Python-level locks to ensure that only one thread accesses the database at a time.
|
||||
|
||||
Here's what it looks like. When a thread needs to access the database, it uses a [`with` block][with] and a "Transaction" [context manager][ctx] to query and manipulate the data. Here's [an example](https://github.com/sampsyo/beets/blob/master/beets/library.py#L1182) in which a Library object looks up an Item by its ID:
|
||||
Here's what it looks like. When a thread needs to access the database, it uses a [`with` block][with] and a "Transaction" [context manager][ctx] to query and manipulate the data. Here's [an example](https://github.com/beetbox/beets/blob/master/beets/library.py#L1182) in which a Library object looks up an Item by its ID:
|
||||
|
||||
with self.transaction() as tx:
|
||||
rows = tx.query('SELECT * FROM items WHERE id=?', (load_id,))
|
||||
|
||||
The only way to access the database is via methods on the [Transaction object][txn]. And creating a Transaction means acquiring a lock. Together, these two restrictions make it impossible for two different threads to access the database at the same time. This reduces the concurrency available in the DB (appropriate for beets but not for, say, a popular Web service) but eradicates the possibility of SQLite timeouts and will make it easy for beets to move to a different backend in the future---even one that doesn't support concurrency itself.
|
||||
|
||||
[txn]: https://github.com/sampsyo/beets/blob/master/beets/library.py#L919
|
||||
[txn]: https://github.com/beetbox/beets/blob/master/beets/library.py#L919
|
||||
|
||||
To make this explicit-transaction approach feasible, transactions need to be *composable:* it has to be possible to take two correctly-coded transactional functions and call them both together in a single transaction. For example, the beets Library has [a method that deletes a single track](https://github.com/sampsyo/beets/blob/master/beets/library.py#L1220). The ["beet remove" command][beet remove] needs to remove *many* tracks in one fell, atomic swoop.
|
||||
To make this explicit-transaction approach feasible, transactions need to be *composable:* it has to be possible to take two correctly-coded transactional functions and call them both together in a single transaction. For example, the beets Library has [a method that deletes a single track](https://github.com/beetbox/beets/blob/master/beets/library.py#L1220). The ["beet remove" command][beet remove] needs to remove *many* tracks in one fell, atomic swoop.
|
||||
|
||||
The smaller method---`Library.remove`---uses a transaction internally so it can synchronize correctly when it's called alone. But the higher-level command has to call it many times in a single transaction, [like so](https://github.com/sampsyo/beets/blob/master/beets/ui/commands.py#L984):
|
||||
The smaller method---`Library.remove`---uses a transaction internally so it can synchronize correctly when it's called alone. But the higher-level command has to call it many times in a single transaction, [like so](https://github.com/beetbox/beets/blob/master/beets/ui/commands.py#L984):
|
||||
|
||||
with lib.transaction():
|
||||
for item in items:
|
||||
|
|
@ -84,7 +84,7 @@ To accomplish this, each thread transparently maintains a *transaction stack* th
|
|||
[ctx]: http://docs.python.org/library/stdtypes.html#typecontextmanager
|
||||
[with]: http://www.python.org/dev/peps/pep-0343/
|
||||
[zen]: http://www.python.org/dev/peps/pep-0020/
|
||||
[nosql]: https://github.com/sampsyo/beets/wiki/Refactoring
|
||||
[nosql]: https://github.com/beetbox/beets/wiki/Refactoring
|
||||
[nop]: http://en.wikipedia.org/wiki/NOP
|
||||
|
||||
## Takeaway for Other Projects
|
||||
|
|
|
|||
|
|
@ -39,8 +39,8 @@ Some dependencies ([Unidecode][], [pyLast][], [Colorama][], and [Bluelet][]) are
|
|||
[web]: http://beets.readthedocs.org/en/1.0b15/plugins/web.html
|
||||
[rg]: http://beets.readthedocs.org/en/1.0b15/plugins/replaygain.html
|
||||
[bpd]: http://beets.readthedocs.org/en/1.0b15/plugins/bpd.html
|
||||
[pyacoustid]: https://github.com/sampsyo/pyacoustid
|
||||
[audioread]: https://github.com/sampsyo/audioread
|
||||
[pyacoustid]: https://github.com/beetbox/pyacoustid
|
||||
[audioread]: https://github.com/beetbox/audioread
|
||||
[pygst]: http://gstreamer.freedesktop.org/modules/gst-python.html
|
||||
[armin]: http://lucumr.pocoo.org/2011/12/7/thoughts-on-python3/
|
||||
|
||||
|
|
@ -54,5 +54,5 @@ While beets will almost certainly not make the Python 3 leap until after [1.0][]
|
|||
|
||||
[1.0]: {{site.url}}/blog/one-point-oh.html
|
||||
[Headphones]: https://github.com/rembo10/headphones/
|
||||
[convention]: https://github.com/sampsyo/beets/wiki/Hacking
|
||||
[fwdc]: https://github.com/sampsyo/beets/wiki/Python3
|
||||
[convention]: https://github.com/beetbox/beets/wiki/Hacking
|
||||
[fwdc]: https://github.com/beetbox/beets/wiki/Python3
|
||||
|
|
|
|||
|
|
@ -25,6 +25,6 @@ So the release schedule is changing. The current development version will become
|
|||
To summarize: 1.0 very soon; Confit right after that. Here goes!
|
||||
|
||||
[Confit]: https://github.com/sampsyo/confit
|
||||
[confit branch]: https://github.com/sampsyo/beets/tree/confit
|
||||
[confit branch]: https://github.com/beetbox/beets/tree/confit
|
||||
[opoblog]: {{site.url}}/blog/one-point-oh.html
|
||||
[changelog]: http://beets.readthedocs.org/en/latest/changelog.html
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ section: blog
|
|||
---
|
||||
Since [the beginning][first commit], beets has been conceptually built around an object--field data model. Your library is made up of *item* objects, which represent audio files, and each item has a bunch of *fields* corresponding to tags on those files: "artist," "title," and "year," for example.
|
||||
|
||||
[first commit]: https://github.com/sampsyo/beets/commit/ee7bb4b9e8932cc186e46e7846a2d0006535c0c5
|
||||
[first commit]: https://github.com/beetbox/beets/commit/ee7bb4b9e8932cc186e46e7846a2d0006535c0c5
|
||||
|
||||
Over the years, beets has grown to support a long [list of fields][]: by my count, we currently support 59. We've used an informal policy of adding almost every reasonable field that a user requests. But even this liberal approach can be too constricting: adding a new field at least requires getting the attention of a developer and then waiting for another beets release to roll around.
|
||||
|
||||
|
|
@ -24,9 +24,9 @@ Then, later, if you want to see all your music whose mood is "sexy," just use th
|
|||
|
||||
$ beet ls mood:sexy
|
||||
|
||||
This is exciting enough on its own---you can classify music based on any criteria you can think of---but it also means many more possibilities for plugins in the future. ([Here](https://github.com/sampsyo/beets/issues/310) [a](https://github.com/sampsyo/beets/pull/101) [are][attachments] [few](https://github.com/sampsyo/beets/issues/266) [ideas](https://github.com/sampsyo/beets/issues/116).)
|
||||
This is exciting enough on its own---you can classify music based on any criteria you can think of---but it also means many more possibilities for plugins in the future. ([Here](https://github.com/beetbox/beets/issues/310) [a](https://github.com/beetbox/beets/pull/101) [are][attachments] [few](https://github.com/beetbox/beets/issues/266) [ideas](https://github.com/beetbox/beets/issues/116).)
|
||||
|
||||
[attachments]: https://github.com/sampsyo/beets/issues/111
|
||||
[attachments]: https://github.com/beetbox/beets/issues/111
|
||||
[modify]: http://beets.readthedocs.org/en/latest/reference/cli.html#modify
|
||||
[list]: http://beets.readthedocs.org/en/latest/reference/cli.html#list
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue