Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
aa
aabrowser
Commits
10fd5e2a
Commit
10fd5e2a
authored
Apr 02, 2011
by
Michael Murtaugh
Browse files
Merge branch 'master' of git.constantvzw.org:aa.aabrowser
parents
1eb84fb0
0dcae6f1
Changes
6
Hide whitespace changes
Inline
Side-by-side
.gitignore
View file @
10fd5e2a
...
...
@@ -7,5 +7,6 @@
*.orig
venv
*.db
*.swp
run/static/cache
aabrowser/media/jquery.ui.playlist.js
View file @
10fd5e2a
...
...
@@ -39,6 +39,7 @@ $.widget("aa.playlist", {
size_url
:
""
,
srt_url
:
""
,
export_audacity_url
:
""
,
import_audacity_url
:
""
,
position_url
:
""
,
updatePositionURL
:
""
,
drop_on_cancel
:
false
,
...
...
aabrowser/templates/resource.html
View file @
10fd5e2a
...
...
@@ -6,6 +6,7 @@
{%block extrahead %}
<script
type=
"text/javascript"
charset=
"utf-8"
>
var
RESOURCE_INFO_URL
=
"
{% url aabrowser.views.resource_info %}
"
;
var
RESOURCE_VIEW_URL
=
"
{% url aabrowser.views.resource resource.id %}
"
;
var
ANNOTATION_URL_TEMPLATE
=
"
{% url aabrowser.views.annotation 0 %}
"
;
...
...
@@ -66,7 +67,18 @@ function play (url, start, end, endedcallback) {
end
:
end
,
delegate
:
info
.
delegate
,
autoplay
:
true
,
controls
:
true
,
controls
:
{
autoHide
:
true
,
height
:
24
,
backgroundColor
:
"
#FFFFFF
"
,
buttonColor
:
"
#000000
"
,
buttonOverColor
:
"
#999999
"
,
timeFontSize
:
9
,
timeColor
:
"
#000000
"
,
timeSeparator
:
"
/
"
,
durationColor
:
"
#000000
"
,
fullscreen
:
false
,
},
ended
:
endedcallback
,
timeupdate
:
function
(
evt
,
params
)
{
$
(
"
.aa-playlist
"
).
playlist
(
"
doTimeUpdate
"
,
params
.
time
,
url
);
...
...
@@ -136,6 +148,21 @@ $("a#textile-help-show").click(function(){ $('div#textile-help').toggle('fast');
})(
jQuery
);
$
(
document
).
ready
(
function
()
{
// SARMA
// Calculate column width according to number of annotations
box_nb
=
$
(
"
div.aa-playlist
"
).
length
;
width
=
100
/
box_nb
;
$
(
"
div.aa-playlist
"
).
css
(
"
width
"
,
width
+
"
%
"
);
// Header fades out when mouse doesn't move for X sec.
$
(
window
).
mousemove
(
function
(){
$
(
"
#header, #resource_header
"
).
stop
().
show
().
css
(
'
opacity
'
,
1
).
animate
({
opacity
:
0
},
2000
);
});
// SARMA END
// COLLAPSE THE SIDEBAR
$
(
"
#sidebar_content
"
).
hide
();
// console.log("scrolling");
...
...
aabrowser/urls.py
View file @
10fd5e2a
...
...
@@ -33,7 +33,8 @@ urlpatterns = patterns('aabrowser.views',
url
(
r
'^annotations/(?P<id>\d+)/export/srt/$'
,
'annotation_export'
,
{},
name
=
'aa-annotation-export-srt'
),
url
(
r
'^annotations/(?P<id>\d+)/export/audacity/$'
,
'annotation_export'
,
\
{
'template'
:
'annotation.audacity.txt'
},
name
=
'aa-annotation-export-audacity'
),
url
(
r
'^annotations/(?P<id>\d+)/import/audacity/$'
,
'annotation_import_audacity'
,
{},
name
=
'aa-annotation-import-audacity'
),
url
(
r
'^annotations/(?P<id>\d+)/import/audacity/$'
,
'annotation_import_audacity'
,
\
{},
name
=
'aa-annotation-import-audacity'
),
url
(
r
'^linktool/$'
,
'linktool'
,
{},
name
=
'aa-linktool'
),
url
(
r
'^linktool/search/$'
,
'linktool_search'
,
{},
name
=
'aa-linktool-search'
),
...
...
aabrowser/utils.py
0 → 100644
View file @
10fd5e2a
from
.timecode
import
timecode_fromsecs
def
audacity2srt
(
data
):
"""docstring for audacity2srt"""
srt
=
""
for
line
in
data
.
splitlines
():
chunks
=
line
.
split
(
' '
)
start
=
timecode_fromsecs
(
float
(
chunks
[
0
].
replace
(
','
,
'.'
)),
alwaysfract
=
True
,
\
alwayshours
=
True
,
fractdelim
=
'.'
)
end
=
timecode_fromsecs
(
float
(
chunks
[
1
].
replace
(
','
,
'.'
)),
alwaysfract
=
True
,
\
alwayshours
=
True
,
fractdelim
=
'.'
)
chunks
[
0
]
=
start
chunks
[
1
]
=
end
srt
+=
chunks
[
0
]
+
"-->"
+
chunks
[
1
]
+
"
\n
"
+
" "
.
join
(
chunks
[
2
:])
+
"
\n
"
srt
=
srt
.
replace
(
'
\\
n'
,
'
\n
'
)
return
srt
aabrowser/views.py
View file @
10fd5e2a
...
...
@@ -30,6 +30,7 @@ from LinkForm import Link_parseText, name_normalize, name_urlunescape
from
models
import
*
import
urllib
,
re
import
django.forms
from
.utils
import
audacity2srt
try
:
import
simplejson
as
json
except
ImportError
:
import
json
...
...
@@ -378,12 +379,17 @@ def annotation_import_audacity (request, id):
data
=
""
for
chunk
in
f
.
chunks
():
data
+=
chunk
# removes current sections
for
section
in
a
.
sections
.
all
():
section
.
delete
()
# updates with the new content
a
.
update_from_text
(
audacity2srt
(
data
))
return
HttpResponse
(
"Import complete, close this window and reload the page"
)
else
:
# display the form
form
=
ImportForm
()
context
[
'form'
]
=
form
return
render_to_response
(
"annotation_import.html"
,
context
,
context_instance
=
RequestContext
(
request
))
return
render_to_response
(
"annotation_import.html"
,
context
,
context_instance
=
RequestContext
(
request
))
class
TagForm
(
ModelForm
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment