Comments (7)
Using the srt command or the library ?
from pysrt.
library
from pysrt.
I'm sorry but I'm not able to reproduce. Can you show me a code sample that behave like that please ?
from pysrt.
$ pip freeze
pysrt==0.4.3
[...]
$ python
Python 2.7.2 (default, Jul 11 2012, 22:02:57)
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
from pysrt import SubRipFile
subs = SubRipFile.open ('Breaking_Bad_-5x08-_TBA.HDTV.asap.en.srt')
subs.shift(-1)
subs.save('out.srt',encoding='utf-8')
exit()
$ head out.srt
1
00:00:00,000 --> 00:00:00,000
Previously on AMC's
Breaking Bad...
2
00:00:00,000 --> 00:00:00,000
Sooner or later
someone is gonna flip.
from pysrt.
Ok it's a bit difficult to see but the shift method signature is:
shift(hours=0, minutes=0, seconds=0, milliseconds=0)
So you ask to shift 1 hour back.
Try this
subs.shift(seconds=-1)
from pysrt.
You're rigth!
Thanks!
from pysrt.
You're welcome. It's my bad, I've never took the time to write a proper documentation.
from pysrt.
Related Issues (20)
- In-place mode does not write the entire file HOT 2
- Inserting Subtitle Snippet
- Can't parse text with empty line HOT 2
- time passed to at() will not find caption if the time passed in equals start time of caption
- UnicodeDecodeError
- Script: parsing transcript .srt files into readable text HOT 1
- the latest code in master was not released
- SubRipTime.__init__ should maybe cast the arguments to int or float (aka “TypeError: '>' not supported between instances of 'SubRipTime' and 'dict'” in slice())
- Faster loading HOT 2
- Tag v1.1.2 HOT 1
- UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' HOT 1
- Weird version ??
- text_without_tags should also remove subtitle tags
- pysrt.open() returns empty list
- Captions whose text begins with Line Separator character are parsed as blank string HOT 1
- pysrt fails to build with Python 3.11.0a1
- Tests fail with Python 3.12 HOT 2
- Subtitle synchronization with input video files.
- SubRipTime.to_time() does not support times over 24 hours
- add `text_without_tags` support to `SubRipFile`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pysrt.