[PR #916] [MERGED] [Fix] fix the python extension brokens (#879) #1751

Open
opened 2026-01-29 17:18:19 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/CCExtractor/ccextractor/pull/916
Author: @lennonwoo
Created: 1/24/2018
Status: Merged
Merged: 1/25/2018
Merged by: @cfsmp3

Base: masterHead: master


📝 Commits (9)

  • 941077c remove swig Auto-generated files
  • b003ed7 remove trivial signal_python_api & global array func
  • 84ce45b be quiet when in PYTHON_API mode
  • 9134322 clear up which function as api
  • da72afe move asprintf to utility
  • ddc7c19 refactor pass_cc_buffer_to_python
  • 180da3e update build scripts
  • a3bb052 update api_testing
  • 7ad5c22 update python extension doc

📊 Changes

29 files changed (+313 additions, -6228 deletions)

View changed files

📝 api/api_testing.py (+30 -21)
📝 api/build_api (+57 -8)
api/build_api_exe (+0 -44)
📝 api/build_library (+1 -2)
📝 api/ccextractor.i (+8 -68)
api/ccextractor.py (+0 -341)
api/ccextractor_wrap.c (+0 -5366)
📝 docs/Python extension module.txt (+18 -24)
📝 linux/Makefile.am (+0 -2)
📝 linux/build (+1 -2)
📝 linux/build_hardsubx (+1 -2)
📝 linux/builddebug (+1 -2)
📝 linux/module_generator (+1 -2)
📝 mac/Makefile.am (+0 -2)
📝 mac/build.command (+1 -2)
📝 src/ccextractor.c (+13 -85)
📝 src/ccextractor.h (+7 -32)
src/extractors/extractor.c (+0 -98)
src/extractors/extractor.h (+0 -9)
📝 src/lib_ccx/ccx_common_option.c (+1 -1)

...and 9 more files

📄 Description

In raising this pull request, I confirm the following (please check boxes):

  • I have read and understood the contributors guide.
  • I have checked that another pull request for this purpose does not exist.
  • I have considered, and confirmed that this submission will be valuable to others.
  • I accept that this submission may not be used, and the pull request closed at the will of the maintainer.
  • I give this submission freely, and claim no ownership to its content.

My familiarity with the project is as follows (check one):

  • I have never used CCExtractor.
  • I have used CCExtractor just a couple of times.
  • I absolutely love CCExtractor, but have not contributed previously.
  • I am an active contributor to CCExtractor.

ABSTRACT

The pull request fix the python extension brokens, now we can use python bindings to deal with the subtitle extracted from video again.

CHANGES

  • We now only use PYTHON_API to preprocessing code for pythoon bingding.
  • Remove the swig auto-generated files which are ccextractor.py and ccextractor_wrap.c
  • Remove signal_python_api and python_subs_array
  • Delete extractor directory and move the function in extractor to ccx_encoders_python.c

MY THOUGHTS

I want to talk about why I remove signal_python_api and python_subs_array.
First, signal_python_api, I notice that this flag variable is used to determine whether we should continue to execute the original ccextractor processing logic or not. But the problem is, do we really need to process original logic when we are using python to deal more detail subtitle things? We could do this thing just use the compiled binary file.
Second, the original code introduce python_subs_array as global variable to deal with the time judgement, this become boresome when we have to free the arrays in the end of api_start fucntion.

KNOWN ISSUES

  • Currently, the updated scripts only compiled with python2.7 as well as python test scripts
  • I introduce custom asprintf function, I have no idea whether it's right thing to do or not.

USAGE

Use ./build_library in api directory to build the pythoon binding, then use python2 api_testing.py options... to test

I have test build script under Linux, the output example in python is as follow

srt_counter-203
start_time-00:09:51,158 end_time-00:09:54,526
text[203]:
color[203]:99999999999999999999999999999999
font[203]:RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR
text[203]:
color[203]:99999999999999999999999999999999
font[203]:RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR
text[203]:
color[203]:99999999999999999999999999999999
font[203]:RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR
text[203]:
color[203]:99999999999999999999999999999999
font[203]:RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR
text[203]:
color[203]:99999999999999999999999999999999
font[203]:RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR
text[203]:
color[203]:99999999999999999999999999999999
font[203]:RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR
text[203]:
color[203]:99999999999999999999999999999999
font[203]:RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR
text[203]:
color[203]:99999999999999999999999999999999
font[203]:RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR
text[203]:
color[203]:99999999999999999999999999999999
font[203]:RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR
text[203]:
color[203]:99999999999999999999999999999999
font[203]:RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR
text[203]:
color[203]:99999999999999999999999999999999
font[203]:RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR
text[203]:
color[203]:99999999999999999999999999999999
font[203]:RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR
text[203]:
color[203]:99999999999999999999999999999999
font[203]:RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR
text[203]: AND THAT WAY WE COULD
color[203]:99999999999000000000000000000000
font[203]:RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR
text[203]: KEEP EACH OTHER WARM?"
color[203]:99999999990000000000000000000000
font[203]:RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR
END OF FRAME


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/CCExtractor/ccextractor/pull/916 **Author:** [@lennonwoo](https://github.com/lennonwoo) **Created:** 1/24/2018 **Status:** ✅ Merged **Merged:** 1/25/2018 **Merged by:** [@cfsmp3](https://github.com/cfsmp3) **Base:** `master` ← **Head:** `master` --- ### 📝 Commits (9) - [`941077c`](https://github.com/CCExtractor/ccextractor/commit/941077c11c3ecc42b70577a676379efa1c2afeff) remove swig Auto-generated files - [`b003ed7`](https://github.com/CCExtractor/ccextractor/commit/b003ed7394a4302c1a0a10fb743ff8fbf206bbe0) remove trivial signal_python_api & global array func - [`84ce45b`](https://github.com/CCExtractor/ccextractor/commit/84ce45b8f0d296a27e2c43e06f7ee3599cf3d42a) be quiet when in PYTHON_API mode - [`9134322`](https://github.com/CCExtractor/ccextractor/commit/913432232d11de080a1023a31c1b952453bc16fb) clear up which function as api - [`da72afe`](https://github.com/CCExtractor/ccextractor/commit/da72afeb7c4c72adb9764560710b5bfb5c020cf6) move asprintf to utility - [`ddc7c19`](https://github.com/CCExtractor/ccextractor/commit/ddc7c197c86312dee56e4dbbececbe02eac181d4) refactor pass_cc_buffer_to_python - [`180da3e`](https://github.com/CCExtractor/ccextractor/commit/180da3ed5af726e555e9c48b788c94aa7923b7a2) update build scripts - [`a3bb052`](https://github.com/CCExtractor/ccextractor/commit/a3bb05242f637b5535fbeff9ed2d839628675af7) update api_testing - [`7ad5c22`](https://github.com/CCExtractor/ccextractor/commit/7ad5c226e60ecb463b38ae607e7f4a49c0f13c7b) update python extension doc ### 📊 Changes **29 files changed** (+313 additions, -6228 deletions) <details> <summary>View changed files</summary> 📝 `api/api_testing.py` (+30 -21) 📝 `api/build_api` (+57 -8) ➖ `api/build_api_exe` (+0 -44) 📝 `api/build_library` (+1 -2) 📝 `api/ccextractor.i` (+8 -68) ➖ `api/ccextractor.py` (+0 -341) ➖ `api/ccextractor_wrap.c` (+0 -5366) 📝 `docs/Python extension module.txt` (+18 -24) 📝 `linux/Makefile.am` (+0 -2) 📝 `linux/build` (+1 -2) 📝 `linux/build_hardsubx` (+1 -2) 📝 `linux/builddebug` (+1 -2) 📝 `linux/module_generator` (+1 -2) 📝 `mac/Makefile.am` (+0 -2) 📝 `mac/build.command` (+1 -2) 📝 `src/ccextractor.c` (+13 -85) 📝 `src/ccextractor.h` (+7 -32) ➖ `src/extractors/extractor.c` (+0 -98) ➖ `src/extractors/extractor.h` (+0 -9) 📝 `src/lib_ccx/ccx_common_option.c` (+1 -1) _...and 9 more files_ </details> ### 📄 Description **In raising this pull request, I confirm the following (please check boxes):** - [x] I have read and understood the [contributors guide](https://github.com/CCExtractor/ccextractor/blob/master/.github/CONTRIBUTING.md). - [x] I have checked that another pull request for this purpose does not exist. - [x] I have considered, and confirmed that this submission will be valuable to others. - [x] I accept that this submission may not be used, and the pull request closed at the will of the maintainer. - [x] I give this submission freely, and claim no ownership to its content. **My familiarity with the project is as follows (check one):** - [ ] I have never used CCExtractor. - [x] I have used CCExtractor just a couple of times. - [ ] I absolutely love CCExtractor, but have not contributed previously. - [ ] I am an active contributor to CCExtractor. --- ### ABSTRACT The pull request fix the python extension brokens, now we can use python bindings to deal with the subtitle extracted from video again. ### CHANGES - We now only use PYTHON_API to preprocessing code for pythoon bingding. - Remove the swig auto-generated files which are ccextractor.py and ccextractor_wrap.c - Remove signal_python_api and python_subs_array - Delete extractor directory and move the function in extractor to ccx_encoders_python.c ### MY THOUGHTS I want to talk about why I remove signal_python_api and python_subs_array. First, signal_python_api, I notice that this flag variable is used to determine whether we should continue to execute the original ccextractor processing logic or not. But the problem is, do we really need to process original logic when we are using python to deal more detail subtitle things? We could do this thing just use the compiled binary file. Second, the original code introduce python_subs_array as global variable to deal with the time judgement, this become boresome when we have to free the arrays in the end of api_start fucntion. ### KNOWN ISSUES - Currently, the updated scripts only compiled with python2.7 as well as python test scripts - I introduce custom asprintf function, I have no idea whether it's right thing to do or not. ### USAGE Use `./build_library` in api directory to build the pythoon binding, then use `python2 api_testing.py options...` to test I have test build script under Linux, the output example in python is as follow > srt_counter-203 start_time-00:09:51,158 end_time-00:09:54,526 text[203]: color[203]:99999999999999999999999999999999 font[203]:RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR text[203]: color[203]:99999999999999999999999999999999 font[203]:RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR text[203]: color[203]:99999999999999999999999999999999 font[203]:RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR text[203]: color[203]:99999999999999999999999999999999 font[203]:RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR text[203]: color[203]:99999999999999999999999999999999 font[203]:RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR text[203]: color[203]:99999999999999999999999999999999 font[203]:RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR text[203]: color[203]:99999999999999999999999999999999 font[203]:RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR text[203]: color[203]:99999999999999999999999999999999 font[203]:RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR text[203]: color[203]:99999999999999999999999999999999 font[203]:RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR text[203]: color[203]:99999999999999999999999999999999 font[203]:RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR text[203]: color[203]:99999999999999999999999999999999 font[203]:RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR text[203]: color[203]:99999999999999999999999999999999 font[203]:RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR text[203]: color[203]:99999999999999999999999999999999 font[203]:RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR text[203]: AND THAT WAY WE COULD color[203]:99999999999000000000000000000000 font[203]:RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR text[203]: KEEP EACH OTHER WARM?" color[203]:99999999990000000000000000000000 font[203]:RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR ***END OF FRAME*** --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-29 17:18:19 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/ccextractor#1751